I am using this code...
public string GetIdentifier()
{
TelephonyManager manager = (TelephonyManager)Forms.Context.GetSystemService(Android.Content.Context.TelephonyService);
return manager.Imei;
}
var deviceInfo = Xamarin.Forms.DependencyService.Get
var number = deviceInfo.GetIdentifier();
lblIMEI.Text = number.Trim();
but i am getting error
Java.Lang.SecurityException: 'getImeiForSlot: The user 10308 does not meet the requirements to access device identifiers.'
Prerna DwivediPosted Jul 15, 2021, 8:05 AM
Manikandan MPosted Jul 13, 2021, 2:14 PM
Hi Prerna,
You want to call
android.telephony.TelephonyManager.getDeviceId().This will return whatever string uniquely identifies the device (IMEI on GSM, MEID for CDMA).
You'll need the following permission in your
AndroidManifest.xml:https://stackoverflow.com/questions/1972381/how-to-get-the-devices-imei-esn-programmatically-in-android