We're having an issue where the extras Bundle from a PendingIntent's Intent are not stored if the app is killed due to low memory.
We create a notificiation:
// ...
final Intent intent = new Intent(this, ControllerActivity.class);
intent.putExtra(KEY_PUSH_NOTIFICATION, notification);
PendingIntent pIntent = PendingIntent.getActivity(this, 9349302, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pIntent);
//...
notificationManager.notify(123, builder.build());
This works fine when the app has not been killed by the OS... We added some code to our onCreate
and onNewIntent
methods to log the extras:
Log.i("Test", "Intent Extras...");
if (intent.getExtras() != null) {
for (String key : intent.getExtras().keySet()) {
Log.i("Test", "Intent Extra: " + intent.getExtras().get(key));
}
}
Here's the LogCat for when the app has not been killed and we open the notification:
I/Test﹕ Intent: Intent { Htcflg=0x1 cmp=com.package.removed.debug/com.package.removed.ControllerActivity bnds=[0,379][1080,571] (has extras) }
I/Test﹕ Intent Extra: com.package.removed.push.PushNotification@425f74b8
Here's the LogCat for when the app has been killed:
I/Test﹕ Intent: Intent { cmp=com.package.removed.debug/com.package.removed.ControllerActivity }
This seems strange, since the docs on PendingIntent
specifically say:
...even if its owning application's process is killed, the PendingIntent itself will remain usable from other processes that have been given it.
We also experimented with the different PendingIntent flags, but no luck.
We're using an app to fill the phone's RAM to bring the phone to a low memory state.
Anyone have any idea what the problem could be?