I'm using an Android IBinder interface to read data from a service. My specific case dictates that I don't know exactly what object I'll be receiving from that service (due to versioning and server side business logic).
From the samples and examples I've seen - when you know which class you'll receive - you can make it parcelable and read it directly from the parcel but for me - this is not relevant.
Is there a way to extract the information received in the parcel without knowing it's structure ? possibly using the parcel meta data or reflection?
I couldn't find any examples online. Any help would be greatly appreciated.
IBinderand just work with ordinary objects, so you can avoid theParcel.Parcelare standardized and let you know how to interpret the rest, I think you're in trouble. For example, if all of theParcelobjects start with some integer or string, and from there you know enough to be able to decide how to read in a bit more, you might be able to pull this off.Class.forName("com.my.object").newInstance()as the Object might not match what is expected. Maybe you could think about simple key/value pairs, like aMap<String, Object>. Could you use AIDL instead, or even a ContentProvider which might provide a better contract?