For some reason, the bundled extra data I'm adding to my intent is not persisting when the intent is received. I've been debugging for quite some time now, but I'm not finding any issues with my code. Perhaps someone can help.
Intent Creation:
// Intent created within an IntentService for an AppWidgetProvider
final Intent textViewIntent = new Intent(this, LocWidgetProvider.class);
textViewIntent.setAction(ACTION_CHANGE_LOCALE);
textViewIntent.putExtra("SomeExtra", "SomeValue");
Log.d("ExtraTest", String.format("Extra data: %s",
textViewIntent.getStringExtra("SomeExtra")));
final PendingIntent textViewPendingIntent = PendingIntent.getBroadcast(this, 0,
textViewIntent, PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews.setOnClickPendingIntent(R.id.SomeButton, textViewPendingIntent);
When Receiving the inent after pressing "SomeButton":
protected void onHandleIntent(Intent intent) {
if(intent.getAction().equals(ACTION_CHANGE_LOCALE))
{
if(!intent.hasExtra("SomeExtra"))
{
Log.d("ExtraTest", "Extra data was null :(");
}
else {
String newLocale = (String)intent.getExtras().get("SomeExtra");
LocaleManager.ChangePhoneLocale(new Locale(newLocale));
}
}
I keep hitting:
"Extra data: SomeValue" (Intent seems to have the data when it is created)
"Extra data was null :(". (Intent no longer has the ExtraData when received
Am I doing something wrong when creating the intent?