How to get device info IMEI programmatically in xamarin android
You'll need the following permission in your
AndroidManifest.xml
:<uses-permission android:name="android.permission.READ_PHONE_STATE" />
in order to do this.
You want to call
android.telephony.TelephonyManager.getDeviceId()
.
This will return whatever string uniquely identifies the device (IMEI for GSM, MEID for CDMA).
Code
Android.Telephony.TelephonyManager mTelephonyMgr;
mTelephonyMgr = (Android.Telephony.TelephonyManager)GetSystemService(TelephonyService);
//IMEI number
String m_deviceId = mTelephonyMgr.DeviceId;
Comments
Post a Comment