Why new activity is opening when notification clicked?

developer

I can see my group of notification on notification bar; fired from Firebase and I want to implement Expandable view of notifications. I am using This link

but I can't implement this because when I click to notifications it open my activity This is my ShowNotification() method

private void showNotificationMessage(Context context, String title, String message, String timeStamp, Intent intent) {
    notificationUtils = new NotificationUtils(context);
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    notificationUtils.showNotificationMessage(title, message, timeStamp, intent);
}

And here is code for Notification Builder

 MyFirebaseMessagingService.notificationMessages.add(message);
    mBuilder = new NotificationCompat.Builder(mContext)
            .setContentTitle(title)
            .setContentText(message)
            .setAutoCancel(false)
            .setSmallIcon(icon)
   //         .setCustomContentView(remoteViews)
   //         .setCustomBigContentView(remoteViews)
            .setContentInfo("" + (MyFirebaseMessagingService.notificationMessages.size()))
            .setGroup(GROUP_KEY);

please suggest me Any intent.Flag or other code so that I can stop activity to be opened on notification click.

yash786

Just remove the below line:

intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

And pass 0 instead of intent:

notificationUtils.showNotificationMessage(title, message, timeStamp, 0);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Resume an activity when clicked on a notification

From Dev

Android: Button not opening new Activity?

From Dev

Opening a new fragment when a ListView item is clicked

From Dev

Parse Push "No Activity Found" on opening Push Notification

From Dev

Showing an Alert Dialog before opening a new activity when Button is Click

From Dev

How to prevent notification from opening an activity or removed when clicked in Android?

From Dev

Get back to previous Activity when Ongoing notification is clicked

From Dev

Invoking new activity class when a tab is clicked in actionbarsherlock

From Dev

How to prevent parent activity of a dialog to show when opening new activity?

From Dev

Stackoverflow, Linkedin like notification when there is new activity

From Dev

Clicking a Button and Opening a new Activity

From Dev

Clicking notification not opening app/activity

From Dev

Opening a new fragment when a ListView item is clicked

From Dev

Start new Activity when html button clicked in Cordova

From Dev

Parse Push "No Activity Found" on opening Push Notification

From Dev

Opening a new activity with Simple adapter

From Dev

How to open a new activity when a button is clicked?

From Dev

Dynamically show specific tab when opening a tabbed activity from notification

From Dev

Notification using setFullScreenIntent() for BigTextStyle opening Activity automatically

From Dev

Proceed to new activity from ListView when clicked

From Dev

How to open the activity that launched a notification when clicked on it?

From Dev

Showing an Alert Dialog before opening a new activity when Button is Click

From Dev

Opening a new JFrame when JButton is clicked

From Dev

Preserve activity stack when notification is clicked

From Dev

How to close previous activity after the notification is clicked and opens a new activity

From Dev

Activity Not opening from the notification bar

From Dev

How to Open New Activity when Recycler Items Are Clicked

From Dev

New Activity crashes when button is clicked

From Dev

New activity not opening

Related Related

  1. 1

    Resume an activity when clicked on a notification

  2. 2

    Android: Button not opening new Activity?

  3. 3

    Opening a new fragment when a ListView item is clicked

  4. 4

    Parse Push "No Activity Found" on opening Push Notification

  5. 5

    Showing an Alert Dialog before opening a new activity when Button is Click

  6. 6

    How to prevent notification from opening an activity or removed when clicked in Android?

  7. 7

    Get back to previous Activity when Ongoing notification is clicked

  8. 8

    Invoking new activity class when a tab is clicked in actionbarsherlock

  9. 9

    How to prevent parent activity of a dialog to show when opening new activity?

  10. 10

    Stackoverflow, Linkedin like notification when there is new activity

  11. 11

    Clicking a Button and Opening a new Activity

  12. 12

    Clicking notification not opening app/activity

  13. 13

    Opening a new fragment when a ListView item is clicked

  14. 14

    Start new Activity when html button clicked in Cordova

  15. 15

    Parse Push "No Activity Found" on opening Push Notification

  16. 16

    Opening a new activity with Simple adapter

  17. 17

    How to open a new activity when a button is clicked?

  18. 18

    Dynamically show specific tab when opening a tabbed activity from notification

  19. 19

    Notification using setFullScreenIntent() for BigTextStyle opening Activity automatically

  20. 20

    Proceed to new activity from ListView when clicked

  21. 21

    How to open the activity that launched a notification when clicked on it?

  22. 22

    Showing an Alert Dialog before opening a new activity when Button is Click

  23. 23

    Opening a new JFrame when JButton is clicked

  24. 24

    Preserve activity stack when notification is clicked

  25. 25

    How to close previous activity after the notification is clicked and opens a new activity

  26. 26

    Activity Not opening from the notification bar

  27. 27

    How to Open New Activity when Recycler Items Are Clicked

  28. 28

    New Activity crashes when button is clicked

  29. 29

    New activity not opening

HotTag

Archive