Passing Objects in IPC using Messenger in Android

2019-08-27 18:16发布

问题:

I am using Messenger instead of aidl in Android for IPC. I have a service with which clients can bind . How can i pass a custom object form service to a client using Messenger Mechanism for IPC so that client can use that object to invoke operations.I know we can send simple data types using Parcelable or databundle but what about custom objects

回答1:

How can i pass a custom object form service to a client using Messenger Mechanism for IPC so that client can use that object to invoke operations.

You can't. Apps in one process cannot hold objects from another process, let alone "invoke operations" upon them.