I have a service running that updates a notification in the notification bar when it recieves a message saying it has to be changed.
However I get the following error so
In your case
contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,0);
if you want to use Intents with the same action but different extras:
Change requestCode
from default "0"
in
getActivity(Context context, int requestCode, Intent intent, int flags)
to something unique like
(int) System.currentTimeMillis();
notification.contentIntent = notificationIntent;
Both steps are mandatory because:
- Option 2 will not work without option 1.
- Option 1 will throw IllegalArgumentException without 2.