すべてのネットワークの情報を取得します。
NetworkInfo[] ni = cm.getAllNetworkInfo();ネットワークの情報を表示します。
Log.d("net", "getDetailedState = " + dt); Log.d("net", "getExtraInfo = " + ni[i].getExtraInfo()); Log.d("net", "getReason = " + ni[i].getReason()); NetworkInfo.State st = ni[i].getState(); Log.d("net", "getState = " + st); Log.d("net", "getSubtype = " + ni[i].getSubtype()); Log.d("net", "getSubtypeName = " + ni[i].getSubtypeName()); Log.d("net", "getType = " + ni[i].getType()); Log.d("net", "getTypeName = " + ni[i].getTypeName()); Log.d("net", "isAvailable = " + ni[i].isAvailable()); Log.d("net", "isConnected = " + ni[i].isConnected()); Log.d("net", "isConnectedOrConnecting = " + ni[i].isConnectedOrConnecting ()); Log.d("net", "isFailover = " + ni[i].isFailover ()); Log.d("net", "isRoaming = " + ni[i].isRoaming ());これは、自分の携帯電話の結果です。
getDetailedState = DISCONNECTED getExtraInfo = dm.jplat.net getReason = dataDisabled getState = DISCONNECTED getSubtype = 0 getSubtypeName = UNKNOWN getType = 0 getTypeName = mobile isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = false isRoaming = false getDetailedState = DISCONNECTED getExtraInfo = null getReason = null getState = DISCONNECTED getSubtype = 0 getSubtypeName = getType = 1 getTypeName = WIFI isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = true isRoaming = false getDetailedState = IDLE getExtraInfo = null getReason = null getState = UNKNOWN getSubtype = 0 getSubtypeName = UNKNOWN getType = 2 getTypeName = mobile_mms isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = false isRoaming = false getDetailedState = IDLE getExtraInfo = null getReason = null getState = UNKNOWN getSubtype = 0 getSubtypeName = UNKNOWN getType = 3 getTypeName = mobile_supl isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = false isRoaming = false getDetailedState = IDLE getExtraInfo = null getReason = null getState = UNKNOWN getSubtype = 0 getSubtypeName = UNKNOWN getType = 4 getTypeName = mobile_dun isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = false isRoaming = false getDetailedState = IDLE getExtraInfo = null getReason = null getState = UNKNOWN getSubtype = 0 getSubtypeName = UNKNOWN getType = 5 getTypeName = mobile_hipri isAvailable = false isConnected = false isConnectedOrConnecting = false isFailover = false isRoaming = false
ソースコードは ここです
Androidに関する課題や、ほしいアプリがあればメールやTwitterで連絡ください。試してみます。