I've built an Android application and I need it to send some data to a REST web API (powered by PHP and Laravel 5).
Currently, this data is fairly large and is contained within a SQLite database on the mobile device. My idea was to send X amount of records in chunks up to the server as a background job after the application was closed and only when Wifi is connected (not over mobile data).
Is this possible in Android? How would I go about doing this? Is there a better way of doing this?
UPDATE:
I understand this question is a tad broad so I'll expand on my thoughts. At the moment, my mobile application communicates using a token which is unique to each device and is managed by the web API. This token is the means of authentication with the device and the user's account on my web service.
The problem I have is sending large amounts of data and I just wondered what the best approach was with some code samples if possible. I have had a look at Sync Adapters from Google's documentation but I'm not entirely sure whether these work when the application has been closed or the phone rebooted:
I sort of want to queue a job in the background which will upload to the web service when there is wifi and for it upload in chunks and delete data from its internal sqlite database when completed (or when the web API responds saying it has received all of the data).
Aucun commentaire:
Enregistrer un commentaire