Detectect GSM

Firpas

Active Member
Licensed User
Longtime User
Hi to everybody.

As everyone knows, there are some devices (tablets) that do not have GSM (No SIM Card).
How I can detect this?

Thanks in advance
 

keirS

Well-Known Member
Licensed User
Longtime User
There are some phones that don't have a SIM card as they use CDMA rather than GSM. I don't know of a way to actually check whether the the phone supports GSM. GetPhoneType from the phone library will return the currently used radio type for the phone but just because it says CDMA does not meant that phone is not capable of GSM. There is also a getSimState() in Android but it isn't wrapped in the phone library; but I guess you could call it with JavaObject.
 

Beja

Expert
Licensed User
Longtime User
most tabs have clear labels next to the SIM card slot.. in case it is not labeled then you can measure
by common sense and also open the slot and see if is for SIM card or SD card. If you mean by code then I am out.
(I hope Luca doesn't see this reply otherwise he will port it to that support post)
 

Firpas

Active Member
Licensed User
Longtime User
Yes, i mean by code of course. The application should have different options if the device supports GSM.

KeirS, can you write the code to call getSimState() with JavaObject?

Thanks for your cooperation

:)
 

keirS

Well-Known Member
Licensed User
Longtime User
Using the Reflection library rather than JavaObject.

B4X:
Dim r As Reflector
 r.Target = r.GetContext
 r.Target = r.runMethod2("getSystemService","phone","java.lang.String")
 Log(r.RunMethod("getSimState"))

You will need to find out the return values from the API documentation.
 
Top