When my application is run in background I can able to show the notification by using NotificationManager. When application is running in foreground if user tries to open the notification which is in the status bar I need to block the activity open proecss. Because of that currently running activity is affected. So I don't want to open the new activity... Thanks in advance..
Asked
Active
Viewed 194 times
3 Answers
0
you can navigate to any activity by using notifications as by using below code
Intent notifyIntent;
notifyIntent = new Intent(activityA.this,activityB.class);
PendingIntent intent =PendingIntent.getActivity(punchclock.this, 0,notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
Good luck

Ram kiran Pachigolla
- 20,897
- 15
- 57
- 78
0
I have already gave notification related details on this given link .. may be this will helps you .. How to execute a method by clicking a notification

Community
- 1
- 1

Daud Arfin
- 2,499
- 1
- 18
- 37
0
When you call mNotificationManager.notify(HELLO_ID, notification); in your service/activity from where you are showing notification pass Intent notificationIntent = new Intent(this); to your pending intent if your activity is opened. Else pass Intent for the activity to open it.

om252345
- 2,395
- 4
- 29
- 31