Android: Managing Multiple Notifications

前端 未结 2 995
萌比男神i
萌比男神i 2020-12-31 13:53

I am trying to create multiple notifications in my application. To identify each notification uniquely, i have given them an unique identificationId. Following is my code:

相关标签:
2条回答
  • 2020-12-31 14:53

    I got the answer. The intents were getting cached in. To, make a new intent, just add the following piece of code:

    saveCallIntent.setData((Uri.parse("custom://"+System.currentTimeMillis())));
    

    This makes the intent unique.

    Also, someone suggested me the following piece of code to make the intent unique:

    saveCallIntent.setAction("actionstring" + System.currentTimeMillis());
    

    It didnt help me, but might be of help to someone else.

    --Chander

    0 讨论(0)
  • 2020-12-31 14:54

    just place the notificationId instead of 0 in pendingIntent.

    PendingIntent.getActivity(this, notificationId, intent,PendingIntent.FLAG_UPDATE_CURRENT));
    

    The user must also update the following code together with the above one to get it working.

     mNotificationManager.notify(notificationId, mBuilder.build());
    
    0 讨论(0)
提交回复
热议问题