Network type unknown on Android Nexus 7 tablet -


i made simple application shows network type on device. have nexus 7 inch tablet , value shown unknown. know nexus 7 not gsm device i.e doesn't need sim card operate. internet wifi router means there must network type.

why giving me value of unknown?

i checked code cannot bug on emulated nexus 7 gives utms type. used this page reference.

telephonymanager used check cellular connectivity only. device not using (since not have sim card), unknown return value.

if want check wifi connection:

connectivitymanager connmanager = (connectivitymanager) getsystemservice(connectivity_service); networkinfo info = connmanager.getnetworkinfo(connectivitymanager.type_wifi);  if (info != null && info.isconnected()) {     // device using wifi connection } 

or, give telephonymanager , use connectionmanager exclusively:

networkinfo info = connmanager.getactivenetworkinfo(); if (info != null && info.isconnected()) {   // device using connection } 

above code check type of connectivity, wifi or cellular.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -