android - WifiManager and ConnectivityManager support in Arc Welder -


i using welder run application apk , looks fine @ beginning realized features wifimanager , connectivitymanager doesn't work correctly.

for example, below function return true regardless of running system of welder's actual connection status , network status change broadcast not kicked in. guarantee app work correctly, need have these kind of functionalities.

are these known issue going fixed ? comment welcomed.

public static boolean isnetworkconnected() {      connectivitymanager mngr = (connectivitymanager) inrestowaitapplication.getinstance()             .getsystemservice(context.connectivity_service);     networkinfo info = mngr.getactivenetworkinfo();      if (info == null             || !mngr.getactivenetworkinfo().isconnected())          return false;      return true; }  public static boolean iswifienabled() {      wifimanager wfmgr = (wifimanager)inrestowaitapplication.getinstance().getsystemservice(context.wifi_service);     return wfmgr.iswifienabled(); } 

use below code , make class networkavailablity.java

public class networkavailablity {  public static boolean checknetworkstatus(context context) {     boolean haveconnectedwifi = false;     boolean haveconnectedmobile = false;      connectivitymanager cm = (connectivitymanager) context             .getsystemservice(context.connectivity_service);      networkinfo[] netinfo = cm.getallnetworkinfo();     (networkinfo ni : netinfo) {         if (ni.gettypename().equalsignorecase("wifi"))             if (ni.isconnected())                 haveconnectedwifi = true;         if (ni.gettypename().equalsignorecase("mobile"))             if (ni.isconnected())                 haveconnectedmobile = true;     }      return haveconnectedwifi || haveconnectedmobile;    }  } 

and in code use these following lines check internet available or not

 if (networkavailablity.checknetworkstatus(getactivity())) {          //code here      }     else     {     // give message here toast or create alert dilog           toast.maketext(context, "no network available",toast.length_long).show();     } 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -