Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android remote method data limit

for my application I need to pass data between my activity and the the service both of which are in different processes. I know that Google recommends to keep the data passed while sending intent to a minimum (not full size bitmaps). Does a similar policy apply when you are communicating with the service over AIDL and want to pass the data via remote method calls?

like image 742
android_devrah Avatar asked Sep 07 '25 03:09

android_devrah


2 Answers

http://developer.android.com/reference/android/os/TransactionTooLargeException.html

" During a remote procedure call, the arguments and the return value of the call are transferred as Parcel objects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail and TransactionTooLargeException will be thrown.

The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. "

So it seems, you should never send any arguments which are more than 1MB in size. Of course you could fail with lesser sized arguments too as explained on android site above.

like image 170
android_devrah Avatar answered Sep 08 '25 22:09

android_devrah


I'm not sure about AIDL, but typically you DO want to keep Intent extras to a minimum. A better solution may be to implement your own ContentProvider and use that to provide data to your other process. This will allow for managed data transfer, and gives you all the extra protections that the ContentProvider API provides.

like image 42
Codeman Avatar answered Sep 08 '25 23:09

Codeman