Android: Intent extras not received

If you have put extras to an intent and they are not received at the receiving activity, there could be 2 reasons..

1. The activity already exists in android backstack and the extras are not caught in onCreate() but they can be found in onNewIntent()

2. If the extras are passed with an activity of a PendingIntent, then as per the official documentation. http://developer.android.com/reference/android/app/PendingIntent.html. So, to pass the extras correctly, either you need to make sure each of the intents are having differentiation in terms of action, data, type, class, and categories. Or cancel the current PendingIntent if exists in the system by using FLAG_CANCEL_CURRENT or FLAG_UPDATE_CURRENT.

Happy Coding..

Advertisements