After login Page, I am downloading data from server using JobIntentService and passing the data to activity via BroadcastReceiver. For smaller amount of data it works fine but when I am working on live data it is giving below exception:

Caused by: android.os.TransactionTooLargeException: data parcel size 1450704 bytes
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(Binder.java:1127)
        at android.app.IActivityManager$Stub$Proxy.broadcastIntent(IActivityManager.java:3893)
        at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1009)
        at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:444) 

I passing data like this from service class : 
Intent intent = new Intent(ACTION_CHECK_DOWNLOADSTATUS);
intent.putExtra("response",response);
sendBroadcast(intent);


But it gives TransactionTooLargeException..
How to prevent this?

How do I pass large amount of Data ??

Pls suggest...
1

There are 1 best solutions below

0
On

You cannot pass "large amount of data" in an Intent. If you have a "large amount of data" to pass then you need to use one of the following:

  • Store the data in SQLite database
  • Store the data in a file
  • Store the data in a public static variable so that it can be accessed by all classes in your application (isn't the best alternative, as there are issues around app restarts, but it is the simplest method)