Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the best approach to sending large amount of data between processes?

Tags:

android

ipc

I know in Android we cannot send beyond 1 MB of data between processes using an aidl generated stub. What other options are there ? Is there something similar in android that I can take a look at ?

like image 988
John11 Avatar asked Sep 29 '22 18:09

John11


1 Answers

in assumption that this object are anyway stored as files in the internal app/ external storage, or SQLite tables, the best approach would be to not "send" them.

instead - implement in your app a ContentProvider that will expose access to them (probably via Uri). the app that should consume this data, will query your ContentProvider, and will get in return Uri that will point to the data path. then via an OutputSteam the data could be fetched.

this approach is good, because the size of the data does not matters at all, and can be event hundreds of megas. the size of the object been transferred with the AIDL stays the same (size of Uri String..)

if this 1MB of data is not stored in one of the above(SQLite or file system) - then something in your app is very wrong :-> because you should not have reference to objects in that size (unless it's bitmaps objects)

more info - http://developer.android.com/reference/android/content/ContentProvider.html

like image 91
Tal Kanel Avatar answered Oct 04 '22 02:10

Tal Kanel