If you need to know sim card information, you can do so very easily in NativeScript for Android. Use the following code:
AndroidManifest.xml
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
NativeScript code
function simManage(){
var tm = android.telephony.TelephonyManager;
var context = utils.ad.getApplicationContext();
var manager = context.getSystemService(android.content.Context.TELEPHONY_SERVICE);
var phoneNumber = manager.getLine1Number();
var countryCode = manager.getSimCountryIso();
var simOperator = manager.getSimOperator();
var carrierName = manager.getSimOperatorName();
var deviceId = manager.getDeviceId();
var deviceSoftwareVersion = manager.getDeviceSoftwareVersion();
var simSerialNumber = manager.getSimSerialNumber();
var subscriberId = manager.getSubscriberId();
var callState = manager.getCallState();
var dataActivity = manager.getDataActivity();
var networkType = manager.getNetworkType();
var phoneType = manager.getPhoneType();
var simState = manager.getSimState();
var isNetworkRoaming = manager.isNetworkRoaming();
var mcc = "";
var mnc = "";
if (simOperator.length >= 3) {
mcc = simOperator.substring(0, 3);
mnc = simOperator.substring(3);
}
return {
phoneNumber:phoneNumber,
countryCode:countryCode,
simOperator:simOperator,
carrierName:carrierName,
deviceId:deviceId,
deviceSoftwareVersion:deviceSoftwareVersion,
simSerialNumber:simSerialNumber,
subscriberId:subscriberId,
callState:callState,
dataActivity:dataActivity,
networkType:networkType,
phoneType:phoneType,
simState:simState,
isNetworkRoaming:isNetworkRoaming,
mcc:mcc,
mnc:mnc
};
}
When you need the information, call simManage()
and it will return the data.