Некоторые вопросы о push-уведомлениях. Как мне оповестить все уведомления о моем приложении, когда я нажимаю один из них? Также ... как я могу рассеять уведомления, если я начну приложение (а не из-за анонимности)?Отклонить Android push Уведомления
Вот как я отправляю уведомление из моего класса GcmIntentService (если это полезно).
private void sendNotification(Bundle extras) {
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
NOTIFICATION_ID = Integer.parseInt(extras.getString("id"));
Intent in = new Intent(this, PushActivity.class);
in.putExtras(extras);
in.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
String msg = extras.getString("msj");
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
in, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("MY TITLE")
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
попробовать 'mBuilder.cancelAll()' –
mBuiler это не позволяет мне делать .cancelAll(); Есть идеи? –
Почему? перейдите к официальному [docs] (http://developer.android.com/guide/topics/ui/notifiers/notifications.html) –