Android: Comment reprendre une application à partir d'une notification?
Je suis en train de programmer mon notification de REPRENDRE mon application, plutôt que de simplement commencer une nouvelle instance de mon application... je suis fondamentalement à la recherche pour elle de faire la même chose que lorsque le bouton d'Accueil est long pressé et que l'application est repris à partir de là.
Voici ce que je fais actuellement:
void notifyme(String string){
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager)
getSystemService(ns);
int icon = R.drawable.notification_icon; //icon from resources
CharSequence tickerText = string + " Program Running..."; //ticker-text
long when = System.currentTimeMillis(); //notification time
Context context = getApplicationContext(); //application Context
CharSequence contentTitle = *********; //expanded message title
CharSequence contentText = string + " Program Running...";//expanded msg text
Intent notificationIntent = new Intent(this, Main.class);
PendingIntent contentIntent = PendingIntent.getActivity(
this, 0, notificationIntent, 0);
//the next two lines initialize the Notification, using the configurations
//above
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText,
contentIntent);
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
}
Je devine que la nouvelle de l'Intention de ligne est l'endroit où se trouve le problème... toute aide serait appréciée!
source d'informationauteur Frank Bozzo
Vous devez vous connecter pour publier un commentaire.
vous devez définir vos drapeaux
Aussi, si vous ne veux plus jamais qu'il y ait une double activité de cet attribut dans le manifeste