I use a custom Parcelable to carry some data to a BroadcastReceiver. Here is what i do:
I register my intent and set the extra Parcelable on it along with an extra c
There is also a bug in Android that can explain this issue in case you try to pass an intent another intent : https://code.google.com/p/android/issues/detail?id=179480&thanks=179480&ts=1436464704
Seems that you face with the issue described here: https://code.google.com/p/android/issues/detail?id=6822
There is a workaround described in one of comments under that link: put your custom Parcelable
into an additional Bundle
. Due to the fact that Bundle
internals are not touched until it's needed, such an Intent
can be delivered to your app, since nobody will try to unmarshal your class outside your app.
Bundle hackBundle = new Bundle();
hackBundle.put("key", myParcelable);
intent.putExtra("bundleKey", hackBundle);
Put com.company.project.MyParcelable
in the actual application, instead of doing whatever games you are playing with classloaders. Then, it should be available from both the sender and recipient of the Intent
.