How to bring Android existing activity to front via notification -
I have an Android application, when it runs a service, I want to show a notification on the status bar. After that user can navigate to other applications by pressing the Home key, however, when I try to bring the last running application back to the notification icon on the front, there is some problem in the current activity. Announce as "single top" mode (I want to run existing activity because there is no affiliate service in it), any kind of activity. Dastor stated before Onrsum. Here is my code to create notification object. Can you please tell me what is wrong, thanks.
Private Zero Shows Notification () {Intentionally Lock = New Intent (getApplicationContext (), MassingTapActivity.class); Pending Intentback = PendingIntext.get Activity (getApplicationContext (), 0, ToolLeach, PendingEngineFLAG_UPDATE_CURRENT); Notification.setApplicationContext (), getText (R.string.GPS_service_name), text, intentback); ....}
private zero show notifications (intent) Lock = new intent (getApplicationContext (myselflotactivity), class); // To add these two lines, your problem will be resolved. Settling ("android.intent.action.MAIN"); ToLaunch.addCategory ("android.intent.category.LAUNCHER"); Pending Intentback = PendingIntext.get Activity (getApplicationContext (), 0, ToolLeach, PendingEngineFLAG_UPDATE_CURRENT); Notification.setApplicationContext (), getText (R.string.GPS_service_name), text, intentback); ...}
Comments
Post a Comment