I have a foreground service notification that when clicked should start an activity. This activity is very short lived before it calls finish().
The first time the notification is clicked it works, the second time and thereafter I get the error:
Sending contentIntent failed: android.app.PendingIntent$CanceledException
In my code when creating the foreground service notification, I've changed the randomActivity.class to another Activity class that does not call finish and it works perfectly on every click. From:
Intent notificationIntent = new Intent(this, RandomActivity.class);
to:
Intent notificationIntent = new Intent(this, HomeActivity.class);
Works fine...
I've used the standard notification code from the Android Developers website, as well as testing it using Notification builder. I get the same result regardless. It works perfectly unless the Activity calls finish();
Is this expected behaviour, a bug, or am I missing something?
I thank you in advance for you help and hopefully a solution!
Note: The notification code I use is completely standard, so I haven't posted it. RandomActivity calls finish(); in onCreate, so there's nothing unusual to see there either.