1

I am developing a form based app in which I wish to store the forms when I am in offline mode and online mode. When user will be offline it will automatically send the data to server whenever it will get internet connection.

I have implemented and tested my api but how to sync the data according to internet connectivity is going over my head. Can someone suggest proper solution.

Is it something related to syncadapter? If I will use cloud ant i.e DBaaS for database , will it be a good choice for me?

Please forward me some code snippets

Thanks in advance

Rahul Saxena
  • 422
  • 1
  • 9
  • 22

2 Answers2

2

You could use Cloudant.

Start by using sync-android on the device to store the data locally.

Then you'll need to be able to detect the device's connectivity status. Use Android's ConnectivityManager to detect when the device is attached to wifi or the cell network using getNetworkInfo.

When your device is connected to wifi, start a replication to the Cloudant server.

Mike Rhodes
  • 1,816
  • 12
  • 15
0

You can check the link below for internet connection status .

Broadcast receiver for checking internet connection in android app

When you have a broadcast receiver that receive internet connection , start an intent for uploading data to server. For that purpose volley is a good library.

https://developer.android.com/training/volley/simple.html

Community
  • 1
  • 1
Abdullah Tellioglu
  • 1,434
  • 1
  • 10
  • 26