How can I find out for sure that device really has gsm, cdma or other cellular network equipment (not just WiFi)? I don't want to check current connected network state, because device can be offline in the moment. And I don't want to check device id via ((TelephonyManager) act.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId() because some devices would just give you polymorphic or dummy device ID.
Actualy, I need to check cell equipment exactly for skipping TelephonyManager.getDeviceId and performing Settings.Secure.ANDROID_ID check on those devices that don't have cellular radio. I have at least one tablet (Storage Options Scroll Excel 7") which returns different IMEIs every time you ask it, although it should return null as it has no cell radio (the same situation here: Android: getDeviceId() returns an IMEI, adb shell dumpsys iphonesubinfo returns Device ID=NULL). But I need to have reliable device id that is the same every time I ask.
I'd be glad to hear your thoughts!
Just in case somebody needs complete solution for this: Reflection is used because some things may not exist on some firmware versions. MainContext - main activity context.
If you're publishing in the store, and you want to limit your application only being visible to actual phones, you could add a
<uses-feature>
into your manifest that asks forandroid.hardware.telephony
. Check out if that works for you from the documentation.