Android 安卓通知持续点击通知
我使用以下代码在我的android应用程序中生成通知 一切正常,但当生成新通知时,仍会单击通知栏这只是在KitKat中,保持所有工作正常。有什么想法吗Android 安卓通知持续点击通知,android,push-notification,google-cloud-messaging,android-notifications,Android,Push Notification,Google Cloud Messaging,Android Notifications,我使用以下代码在我的android应用程序中生成通知 一切正常,但当生成新通知时,仍会单击通知栏这只是在KitKat中,保持所有工作正常。有什么想法吗 private static void generateNotification(Context context, String message) { long when = System.currentTimeMillis(); NotificationManager notificationManager = (Notifi
private static void generateNotification(Context context, String message) {
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher, message, when);
String title = "Application Name";
Intent notificationIntent = new Intent(context, MainActivity.class);
notificationIntent.putExtra("message", message);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent =
PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults|= Notification.DEFAULT_LIGHTS;
notification.defaults|= Notification.DEFAULT_VIBRATE;
notification.flags |= Notification.DEFAULT_LIGHTS;
notificationManager.notify(0, notification);
}
提前感谢请看这里,谢谢您的评论。但是仍然有这个问题