I have a notification about the maintenance of the foreground, which when clicked should start with the action. This operation is very short before it calls finish ().
The first time the notification is clicked, it works, the second time and after that I get an error message:
Sending contentIntent failed: android.app.PendingIntent$CanceledException
In my code, when creating a front-end maintenance notification, I changed randomActivity.class to another Activity class that does not cause termination, and it works great every time I click. From:
Intent notificationIntent = new Intent(this, RandomActivity.class);
in
Intent notificationIntent = new Intent(this, HomeActivity.class);
Works great ...
I used the standard notification code on the Android Developers website and also tested it with the Notification builder. I get the same result regardless. It works fine if Activity calls finish ();
Is this expected behavior, a mistake, or am I missing something?
I thank you in advance for your help and, I hope, a solution!
Note. The notification code that I use is completely standard, so I did not post it. RandomActivity calls finish (); in onCreate, so nothing unusual is visible there.
source share