I want to send a broadcast message with intent within extra data of my custom type which implements Parcelable.
In more details: I want to create a shortcut on the HS
However system does not accept object of my custom Command type, error message: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.solvek.ussdfaster.entities.Command
This object will be passed back to my app when user clicks on the shortcut.
Intent shortcutIntent = new Intent(this, FormActivity.class);
shortcutIntent.putExtra("command", command); // Note - commmand is my custom object
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, command.getTitle());
Parcelable iconResource = Intent
.ShortcutIconResource
.fromContext(this, R.drawable.ic_launcher);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(intent);