Intent is losing values in extras
I have a GCMIntentService where I am setting details for the intent and
all when the user clicks on the notification. My code snippet relevant to
this is below:
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(context, CustomTabActivity.class);
if (noteId != null && value != null) {
notificationIntent.putExtra("noteId", noteId);
notificationIntent.putExtra("value", value);
}
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification updateComplete = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(msg)
.setTicker(title)
.setWhen(System.currentTimeMillis())
.setContentIntent(contentIntent)
.setDefaults(Notification.DEFAULT_SOUND)
.setAutoCancel(true)
.setSmallIcon(R.drawable.icon)
.build();
notificationManager.notify(100, updateComplete);
Whenever CustomTabActivity.class is opened, the getExtras() call is always
null. Why is it that I am not able to get the values from intent?
I read the following for this and was not able to solve it:
how to pass string one activity to another?
Android - how can I send a GCM push notification with instructions of
which activity to load?
No comments:
Post a Comment