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.'

Manikandan MRank #731 · 3.2K reputationPosted Jul 13, 2021, 10:14 AM EDT
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-androidPrerna Dwivedi86 reputationPosted Jul 15, 2021, 4:05 AM EDT