private static void sendAlert(int stringResId, int _id, String name, Context context) {
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher);
int notificationid = _id + stringResId;
boolean isShowing = isNotificationVisible(context, notificationid);
NotificationCompat.Builder notification;
if (!isShowing) {
notification
= new NotificationCompat.Builder(context)
.setContentTitle(name)
.setSmallIcon(R.mipmap.ic_launcher_small)
.setTicker(name + " " + context.getString(stringResId))
.setStyle(new NotificationCompat.BigTextStyle().bigText(context.getString(stringResId)))
.setContentText(context.getString(stringResId))
.setDefaults(Notification.DEFAULT_ALL)
.setOnlyAlertOnce(true)
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setLargeIcon(bitmap);
NotificationManager NotifyMgr = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
NotifyMgr.notify(notificationid, notification.build());
}
}
AlarmChecker.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:com.ruuvi.station
作者:
评论列表
文章目录