ScannerService.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:com.ruuvi.station 作者:
public void startFG() {
    Intent notificationIntent = new Intent(this, MainActivity.class);

    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

    NotificationCompat.Builder notification;
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
    notification
            = new NotificationCompat.Builder(getApplicationContext())
            .setContentTitle(this.getString(R.string.scanner_notification_title))
            .setSmallIcon(R.mipmap.ic_launcher_small)
            .setTicker(this.getString(R.string.scanner_notification_ticker))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(this.getString(R.string.scanner_notification_message)))
            .setContentText(this.getString(R.string.scanner_notification_message))
            .setAutoCancel(true)
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .setLargeIcon(bitmap)
            .setContentIntent(pendingIntent);

    startForeground(notificationId, notification.build());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号