Majid Abarghooei
Majid Abarghooei

Reputation: 663

How to retrieve IMSI using PhoneGap?

I'm working on a cross platform mobile app using PhoneGap and I need to retrieve the IMSI code.

Here's the question: Is there any way to do this via PhoneGap?

I appreciate your comments.

Upvotes: 1

Views: 475

Answers (1)

Arjun T Raj
Arjun T Raj

Reputation: 3207

hi for android we can find via native code , for phonegap we need to write a plugin, java code is given bellow

 public String findDeviceID() {
     String deviceID = null;
     String serviceName = Context.TELEPHONY_SERVICE;
     TelephonyManager m_telephonyManager = (TelephonyManager) getSystemService(serviceName);
     int deviceType = m_telephonyManager.getPhoneType();
     switch (deviceType) {
         case (TelephonyManager.PHONE_TYPE_GSM):
             break;
         case (TelephonyManager.PHONE_TYPE_CDMA):
             break;
         case (TelephonyManager.PHONE_TYPE_NONE):
             break;
         default:
             break;
     }
     deviceID = m_telephonyManager.getDeviceId();
     return deviceID;
 }

for creating phonegap plugin check this http://docs.phonegap.com/en/edge/guide_platforms_android_plugin.md.html#Android%20Plugins

Upvotes: 1

Related Questions