The Background Service is used in the application and the message is pushed in the notification bar. You want to click this message to return to the activity,
There are always several identical activities in the result. Even if the returned activity is in the foreground, clicking the message will re-open the same activity and return several times to exit,
Instead of returning a click notification message like qq to an existing activity
It is a bit difficult to say. If you encounter such problems, you will certainly understand them. If you have never encountered such problems, you may not be able to understand this chaotic expression .....
After reading the information, we solved the problem through the following methods,
In fact, the main credit is 10th rows,
Public void shownotification (String msg) {icationicationmanager barmanager = (icationicationmanager) getSystemService (Context. NOTIFICATION_SERVICE); Notification notice = new Notification (android. r. drawable. stat_policy_chat, "the server sent the message", System. currentTimeMillis (); notice. flags = Notification. FLAG_AUTO_CANCEL; Intent appIntent = new Intent (Intent. ACTION_MAIN); // appIntent. setAction (Intent. ACTION_MAIN); appIntent. addCategory (Intent. CATEGORY_LAUNCHER); appIntent. setComponent (new ComponentName (this. getPackageName (), this. getPackageName () + ". "+ this. getLocalClassName (); appIntent. setFlags (Intent. FLAG_ACTIVITY_NEW_TASK | Intent. FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); // set the start mode to PendingIntent contentIntent = PendingIntent. getActivity (this, 0, appIntent, 0); notice. setLatestEventInfo (this, "notification", "information:" + msg, contentIntent); barmanager. Y (STATUS_BAR_ID, notice );}