networking - How to make android app work in offline mode -


i want know how can make app work in offline when user lost network connectivity.

i need post data server using json post method when user not connected wifi or mobile data.

i using following code detect network state using broadcast receiver , don't know how proceed after this.
please assist me proceed further.

public class updatereceiver extends broadcastreceiver {      @override     public void onreceive(context context, intent intent) {          connectivitymanager connectivitymanager = (connectivitymanager) context                 .getsystemservice(context.connectivity_service);         networkinfo activenetinfo = connectivitymanager                 .getnetworkinfo(connectivitymanager.type_wifi);         boolean isconnected = activenetinfo != null                 && activenetinfo.isconnectedorconnecting();         if (isconnected) {             log.e("net", "connected" + isconnected);          } else {             log.e("net", "not connected internet" + isconnected);         }     } } 

in this post, given how fetch data sqlite database. , can post data server using this method. can write code in your

if(isconnected){   } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -