How do I know if a particular device supports SIM?

I wanted to disable the functions related to CALL and SMS in my application based on the presence of a SIM card or not. Now the beginners approach to this will check the type of phone using:

if (telephonyManager1.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) 

If true, then supported.

Everything was fine until I came across a Sony Tablet S, which only supports data and message SIM. No voice support. Therefore, for this device, I need to disable only the CALL function, but continue to support SMS. Sony tablet returns TelephonyManager.PHONE_TYPE_NONE, so I can not use the above methods. Besides,

 telephonyManager1.getSimState(); 

returns 1 ie SIM_STATE_ABSENT, which is also the same in the case of HTC FLYER, which does not have support for the SIM equipment itself.

So, is there a way to find out if there is SIM equipment there (regardless of the inserted SIM card or not)?

+8
android telephony tablet
source share
1 answer

Using

 PackageManager pm = this.getPackageManager(); boolean hasTelephony=pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); 

Edit:

Try using

 TelephonyManager.getLine1Number() 

If this returns null, then you will not have a telephony function. I have not tried it. take a picture

0
source share

All Articles