Reputation: 73
in this project I'm working on, there are a bunch of alarms that are created, and when they go off this is what I have currently happening..
Alarm Goes off
Notification is put in the status bar
When user selects the notification it takes them to a specific Activity in the app to handle the notifications that are currently active
As long as there are un-handled notifications, the notification stays in the Status bar
Now the problem with this, is that when the user selects the alarm from the notification centre, it stays there, but it becomes 'dead', if the user leaves the app, and then clicks that notification again, it wont take the user back into the App, this is what LogCat is saying...
StatusBar - Sending contentIntent failed: android.app.PendingIntent$CanceledException
InputManagerService - Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44f94258
I'm coming up dry with a solution that I can get to solve this problem... Anyone else dealt with this issue?
Upvotes: 0
Views: 1046
Reputation: 23787
Answer: the requestCode and the Notification ID must match, see my use of iAlertUniqueID
below :
notification.contentIntent = PendingIntent.getActivity(context, iAlertUniqueID, targetActivityIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
notificationMgr.notify(iAlertUniqueID++, notification);
the iAlertUniqueID
is just a static int (not final!) in my class that extends BroadcastReceiver
Upvotes: 1