Question

is there any possible way to pass a large amount of data into an Android Service that runs on a different process from the main activity? The data to pass is a byte array of around 5Mb. As notes, I cannot save the data to file to do the transfer, needs to be transferred purely via memory or any other way which isn't to persist to file, databases, etc.

I've tried via AIDL, but seems in Android under AIDL the parcelable data is limited 1Mb. Also slicing the data and transferring it via chunks is not an option. Should be 1 single transaction. I've also tried Intents, but again the same limitations of 500Kb to 1Mb.

So I am running out of ideas.

Was it helpful?

Solution

What about shared memory ashmem http://www.androidenea.com/2010/03/share-memory-using-ashmem-and-binder-in.html

Memory file is an ashmem wrapper http://developer.android.com/reference/android/os/MemoryFile.html

Or you could try opening a socket or ServerSocket in your service and connecting to it from your activity

http://developer.android.com/reference/java/net/ServerSocket.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top