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());
}
ScannerService.java 文件源码
java
阅读 44
收藏 0
点赞 0
评论 0
项目:com.ruuvi.station
作者:
评论列表
文章目录