I get Active network. If active network isn't, app makes exception.
ConnectivityManager cm = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo();
I print network information.
NetworkInfo.DetailedState dt = ni.getDetailedState(); Log.d("net", "getDetailedState = " + dt); Log.d("net", "getExtraInfo = " + ni.getExtraInfo()); Log.d("net", "getReason = " + ni.getReason()); NetworkInfo.State st = ni.getState(); Log.d("net", "getState = " + st); Log.d("net", "getSubtype = " + ni.getSubtype()); Log.d("net", "getSubtypeName = " + ni.getSubtypeName()); Log.d("net", "getType = " + ni.getType()); Log.d("net", "getTypeName = " + ni.getTypeName()); Log.d("net", "isAvailable = " + ni.isAvailable()); Log.d("net", "isConnected = " + ni.isConnected()); Log.d("net", "isConnectedOrConnecting = " + ni.isConnectedOrConnecting ()); Log.d("net", "isFailover = " + ni.isFailover ()); Log.d("net", "isRoaming = " + ni.isRoaming ());
This result is 3g mobile active:
getDetailedState = CONNECTED getExtraInfo = dm.jplat.net getReason = apnSwitched getState = CONNECTED getSubtype = 0 getSubtypeName = UNKNOWN getType = 0 getTypeName = mobile isAvailable = false isConnected = true isConnectedOrConnecting = true isFailover = false isRoaming = falseThis result is wifi active:
getDetailedState = CONNECTED getExtraInfo = null getReason = null getState = CONNECTED getSubtype = 0 getSubtypeName = getType = 1 getTypeName = WIFI isAvailable = true isConnected = true isConnectedOrConnecting = true isFailover = false isRoaming = falsesource code is here.
Please suggest your android issue by twitter or mail, I would try to clear up your issue.
0 件のコメント:
コメントを投稿