iOS Question Get Country ?

tufanv

Expert
Licensed User
Longtime User
Hello,

Is there any way to get the device's country like the b4a simcard library ?

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Yes:
B4X:
Dim no As NativeObject
no = no.Initialize("CTTelephonyNetworkInfo").RunMethod("new", Null).RunMethod("subscriberCellularProvider", Null)
Dim iso As String = no.GetField("isoCountryCode").AsString
Log(iso)
It will return null if there is no sim card or the device is in airplane mode.
 
Upvote 0
Top