Notification permettant de retrouver une activity
Bonjour,
J'ai ce code qui me permet d'afficher le titre et l'auteur d'un artiste de mon player:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| private void notifierTitre(String titre,String artiste){
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager nm = (NotificationManager) this.getSystemService(ns);
nm.cancel(R.string.app_name);
int icon = android.R.drawable.ic_media_play;
CharSequence tickerText = "Titre en lecture";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
CharSequence contentTitle = titre;
CharSequence contentText = artiste;
Intent notificationIntent = this.getIntent();//new Intent(this, HappyPlayer.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(this, contentTitle, contentText, contentIntent);
nm.notify(NOTIF_ID, notification);
} |
Cependant, lorsqu'on clique sur la notification je souhaiterais que cela me ré-ouvre l'activity du player et non une nouvelle activity du player.
Savez-vous comment faire ?