androidserviceandroid-activitydata-exchange

Exchanging BIG sets of data between activity and remote service


What is the recommended approach/pattern for exchanging big chunks of data between activities and remote services? The data I want activities to receive is non primitive and is contained in HashMaps of <Object, List<OtherObject>>. Parcelable seems to be complete overkill to me, is there another way? Oh, and this exchange takes place every 4 sec. on average.


Solution

  • The most efficient way of exchanging big chunks of data between processes in Android is ashmem. There is a Java wrapper for ashmem - MemoryFile, but it is rather confusing - you need to pass parcelable file descriptor between processes, please refer to this SO post

    Then you can just serialize your data into that "file" and deserialize it on the other side.