Insert title here

Case Studies

Bringing your idea to life and in front of billions of eyes

Android - Offline mode - Syncing data
Android (K Praveen)

Question: I am working on android application which is driver application. The main of the driver application is to deliver the orders for the a particular client.

The driver will received a bulk of orders and he can change the status of each one e.g. (in_transit, on hold, delivered, canceled, rejected). Once the internet connection is dropped the driver is blocked from any action.

My goal is how can i make the application running in offline mode, once the internet connection is dropped the driver is still can take an action of each order and he can change the status locally for each one from new to in_transit to deliver and so one. And once the internet connection is back i can sync/push the data to server.

So my questions are: - How can i do that? - What should i saved to sync the api requests or order status?



You can follow these steps in your app:

  1. Create a Local Database with a schema that holds the information regarding the stops and items.
  2. In the beginning, when a driver is starting his journey, he must be having the Internet. Fetch all the deliveries information and save it to the local database for use.
  3. Show this list to the driver from your local database.
  4. You can have 2 Flags named delivery_status and synced. Initially, delivery_status can be in_transit and the synced flag must be false.
  5. Create a background service that keeps checking for Internet Connection at a certain interval. If there is no internet, the service stops and nothing happens. But, if there is an Internet, fetch all the unsynced **(synced = false) ** data from the local database, and send the data to the server. After a successful response from the server, mark this synced flag to true. Repeat this step at every certain interval to check for unsynced data and keep sending this to the web server until all synced flags are true.

This way, you can make the driver deliver the items without having internet at times, and as soon as the internet is available, your background service will upload the status to the server.

Add Comment     See All Comments
cap michael jordan coach signature canvas wristlet saucony jazz o vintage chris kreider rangers jersey juventus football kit junior for cheap 50 outfits to style movekappa
cincinnati reds dog ear hat clips oversized t shirts forever 21 red bottom booties juan soto jersey youth the north face nuptse 800 eygeny flat ahealthynewu
footlocker lebron jerseyvintage dallas cowboys shirtsaints alvin kamara jerseynfl army hoodie distressed san francisco giants hat 80dolphins nfl hat zoomatlanta braves mesh hat billigatlanta braves blue mountain hat 2016 blue gray mother of the bride dresslace overlay dressdress white long sleevecheap a line wedding dresses turquoise red bottomsmens louboutin salechristian louboutin outlet online storechristian louboutin iriza cami dressfloaty pink dressblue and white cocktail dresswestern wedding dresses for girls iphone 8 plus sports caseredmi 6a pouch modelblack marble iphone 12 casespigen case for oneplus 8 pro ecvine
mens puma suede classic casual shoes heels pole nike lebron soldier 9 all white blue elite herman edwards mens jersey philadelphia eagles 46 road white nfl cheap prom dress stores louboutin pigalle 100 sadlifebox
red satin top long sleevegreen leopard print shirt dressmens short sleeve thermal topcomfort color long sleeve with pocket predators dog jerseyzach lavine jordan jerseyhakeem olajuwon 1996 all star jerseyjason kelce super bowl jersey latex midi dresshawaiian 2 piece outfitmadewell rainbow stripe dressalex perry yellow dress nike fingertrap max sky bluedior jordans noirnike air max 90 hvit size 5mens jordan maxin 200 basketball shoes noir mini tweens in short dressesorange silk maxi dresslittle black dress revolveteal short dress moncler wilms giubbottomoncler tweedmoncler frgmt montmens moncler jacket black maktuobe

Tech Divinity cloud enable faster performance