Android notification FLAG_AUTO_CANCEL pas de travail et ne montrant pas de nouvelle Activité
J'ai cherché pendant presque une journée pour ce problème, j'ai suivi l'exemple sur les notifications Android ici: http://www.vogella.com/articles/AndroidNotifications/article.html. Il a bien travaillé et je peux envoyer le Notification
. Le problème c'est que quand je clique sur la notification, il ne disparaît PAS, même si j'ai mis:
setAutoCancel(true)
ET notification.flags |= Notification.FLAG_AUTO_CANCEL
Mise à jour: Voici mon code
Intent intent = new Intent(MyNotification.this, NotificationReceiver.class);
PendingIntent pIntent = PendingIntent.getActivity(
MyNotification.this, 0, intent, 0);
NotificationCompat.Builder builder =
new NotificationCompat.Builder(MyNotification.this)
.setSmallIcon(R.drawable.ic_launcher)
.setAutoCancel(true)
.addAction(R.drawable.ic_launcher, "Call", pIntent)
.addAction(R.drawable.ic_launcher, "More", pIntent)
.addAction(R.drawable.ic_launcher, "And more", pIntent)
.setContentTitle("New mail from " + "[email protected]")
.setContentText("Subject");
Notification noti = builder.build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
Toute idée d'où le problème vient? Merci pour votre aide.
Code postal où vous générez de notification?
J'ai le même problème...avec le même code...je ne comprends pas où je me trompe...Merci de nous aider. Merci beaucoup
J'ai aussi le même problème et n'ont pas la moindre idée pour résoudre ce problème, peut-on s'il vous plaît nous aider..
J'ai le même problème...avec le même code...je ne comprends pas où je me trompe...Merci de nous aider. Merci beaucoup
J'ai aussi le même problème et n'ont pas la moindre idée pour résoudre ce problème, peut-on s'il vous plaît nous aider..
OriginalL'auteur user2652394 | 2013-08-28
Vous devez vous connecter pour publier un commentaire.
de notification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL
Android notification ne disparaît pas après avoir cliqué sur la notification
OriginalL'auteur Aarun
Essayez de supprimer:
Il devrait fonctionner sans noti.drapeaux.
La nouvelle façon d'utiliser les drapeaux dans NotificationCompat est d'utiliser les méthodes définies, comme setAutoCancel(true).
OriginalL'auteur clauziere