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
nfl nike authentic jerseys the bar silk twist dress los angeles dodgers fitted hat lyrics leopard shirt outfit boston red sox hat flex fit black kit name nike air vortex retro quattic
michael kors morgan medium leopard jacquard backpackmichael kors brooke largeblush pink michael kors bagmk smartphone wallet round and square louboutin aj green bengals jersey nike mercurialx proximo cr7 men's indoor football bootsjordan flight 45 hvit gumkyrie 2 blancoall pink nike lebron ambassador 10 maria b designer suit sweat big pony ralph laurenfleece lined flannel womensblue button up shirt womens short sleevemens henleys short sleeve osterwoche
nba navy blue jersey england 2004 jerseydeshaun watson in a 49ers jerseykam chancellor jerseynuggets jersey murray new arrival party wear dresses chicago cubs 23 ryne sandberg gray jersey nike lunarepic low flyknit 2 womensadidas nmd city sock all hvitnike medical pulse free noirnike roshe run villain rosso dwyane wade jersey ebay agencecodit
adidas nmd grau and rot onitsuka tiger edr 78 deluxe cheap soccer training shirts nike sb grey and black uv react air force 1 pandora earrings for mens risetj
air max 2012nike air force 1 black grey blue shoesnemeziz adidasnike tiempo legend vi grey white shoes burberry white long sleeve poloone shoulder t shirt dressyoga graphic teesnorth face gilets aesthetic overall dress oakland athletics fitted hats fresh ivory satin bridesmaid dresses coach legacy large wristletmk blue crossbodymichael kors ew tz totemichael kors nomad large tote bag cefashion

Tech Divinity cloud enable faster performance