How to Get Imei from Android or Iphone

For android it's pretty straight forward. You just have to add read phone state permission.

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

And call the API:
String imei = TelephonyManager.getDefault().getDeviceId();
if (TextUtils.isEmpty(imei)) {
  return "";
}

For iPhone I guess IMEI is not accessible as you could read on most articles. But perhaps you can use the device unique identifier.

UIDevice *myDevice = [UIDevice currentDevice];
NSString *deviceUDID = [myDevice uniqueIdentifier];

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source
Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.