Shortcut intent extras lost after restart?
Asked Answered
G

1

3

My application listens to the android.intent.action.CREATE_SHORTCUT broadcast, in my code I am creating a shortcut which includes a String extra like this:

Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
shortcutIntent.setClassName("com.some.name","com.some.name.Activity");
shortcutIntent.putExtra("stringid", "some string value");
ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(ShortcutActivity.this,iconIdentifier);

Intent intent = new Intent();

intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, channelName);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
setResult(RESULT_OK, intent);

The shortcut works BUT the extras are lost on each phone reboot (they return null, I checked logs and debugged). Is this normal behaviour? I am doing it wrong? I need to pass the extras to the activity.

Guan answered 4/5, 2011 at 17:48 Comment(2)
Ok, I am answering my own question. I was placing a String array into the intent extra. Home screen will not persist string arrays! I found the answer at: groups.google.com/group/android-developers/browse_thread/thread/…Guan
Will do, but I have to wait 8 hours until I can answer my own question.Guan
G
1

I am answering my own question. I was placing a String array into the intent extra. Home screen will not persist string arrays!

I found the answer at: http://groups.google.com/group/android-developers/browse_thread/thread/7f2ce458bd5d112f/189e2b7b2b2532d7

Guan answered 5/5, 2011 at 7:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.