Download Large Data From Json Using Volley In Android
Solution 1:
I think it crashes because of timeOutError. When volley has to parse a large amount of data, you should set the timeout for your volley request. Default timeout is 2500ms, set it to 10000ms or higher it'll work for ex.
strReq.setRetryPolicy(new DefaultRetryPolicy(10000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
It will not consume all the time that you allotted, but it will be disconnected once all the data is fetched
timeoutError will not give you crash, but onErrorResponse would be called, please make sure that tables that you are going to insert into were created before making insert operation.
Solution 2:
1- Use Gson for parsing data and store in ormlite database. 2-After the modification to database tables you should be synchronize table row bye row using sync adapter to server. 3-Make Service for synchronize to server
Solution 3:
I think you are getting OutOfMemoryException, am i right ? Make paging for huge data, you can pull 100 by 100 or 1000 by 1000 from server,then you can store them in sqlite directly
Solution 4:
Enable largheap in application manifest. Use this link to know how to enable it
I am using retrofit to download large file. Try to parse using jsonreader for large data.
Solution 5:
I am not sure what type of server technology you are using. Downloading 17K + data and uploading the same amount overtime is I guess not the optimum use of technology.
Try some technology which reduces your burden about data sync and parsing. I am sure you are aware about Firebase by google. that one of the solution in this case.
Let me know if I misunderstood your question in this case.
Post a Comment for "Download Large Data From Json Using Volley In Android"