Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to tell if an android device is wifi-only?

Tags:

android

I am trying to find a reliable way to tell if an Android device is wifi-only. I tried a couple of ways:

-- Try to get device ID (IMEI/MEID), if I can not get the IMEI/MEID number, then I can assume the device is wifi-only. This doesn't work as some phones do not return a device ID when they are put in flight mode. -- Try to read TelephonyManager.getPhoneType. This doesn't work either as the wifi-only device I am testing with returns PHONE_TYPE_GSM, while I expect it to return PHONE_TYPE_NONE.

I wonder if anyone has successfully distinguish wifi-only devices and the non-wifi-only ones.

like image 366
user967113 Avatar asked Sep 27 '11 13:09

user967113


People also ask

How do I know if my phone is using Wi-Fi or data?

On Android phones: Go to Settings. Tap Connections. Then, tap Data Usage.

How do I know if my Samsung tablet is Wi-Fi or cellular?

To check the cellular and power status On the home screen, tap Apps > Settings. Find and tap About Device > Status.

Can you use a Android phone with just Wi-Fi?

Wi-Fi powered smart phones can access the Internet via Fon hot spots. Generally speaking, connecting a smart phone to an 802.11b or 802.11g Wi-Fi router smart phone works in exactly the same way as from a laptop. If the router accepts authenticated connections only, use the smart phone's Internet browser to log in.


2 Answers

You could query the system features in your app to see if that works.

PackageManager pm = getPackageManager();
boolean isAPhone = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);

If you care about GSM/CDMA use the more specific FEATURE_TELEPHONY_GSM or FEATURE_TELEPHONY_CDMA.

If the device is lying there is of course not much you can do afaik.

like image 122
Jens Avatar answered Oct 03 '22 11:10

Jens


Following solution worked for me better:

TelephonyManager mgr = (TelephonyManager)ctx.getSystemService( Context.TELEPHONY_SERVICE );
return mgr.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;

And following did NOT work on few devices like Nook Tablet:

PackageManager pm = ctx.getPackageManager();
return pm.hasSystemFeature( PackageManager.FEATURE_TELEPHONY );
like image 27
Sileria Avatar answered Oct 03 '22 10:10

Sileria