android - Possible to observe network status? -


i'm wondering if there's way somehow register observer network access (and have callback function run when internet avaliable), or if polling way. thanks!

you can register receiver:

//callback   private final broadcastreceiver mnetworkstatereceiver = new broadcastreceiver() {     @override         public void onreceive(context context, intent intent) {            //network state changes, can process it, inforamtion in intent         }     };  //registering recievr in actibity or in service intentfilter mnetworkstatefilter = new intentfilter(connectivitymanager.connectivity_action); registerreceiver(mnetworkstatereceiver , mnetworkstatefilter); 

detail at: http://developer.android.com/reference/android/net/connectivitymanager.html


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -