I need to validate IMEI number, is their any mechanism for validating the input IMEI? Can we get status of validation in true or false ?
How can we validate IMEI Number after Android version 10?
1.1k Views Asked by sarjeet singh At
2
There are 2 best solutions below
1
On
No, you cannot get IMEI after Android 10, Use This Approach will do the same purpose, but beware it's not the same for debugging and release also it contains both Numbers and Letters.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
imei = Settings.Secure.getString(Objects.requireNonNull(getContext()).getContentResolver(), Settings.Secure.ANDROID_ID);
}
You cannot, Third-party apps can not use IMEI nor the serial number of a phone and other non-resettable device identifiers.
You can still get the non-resettable device identifiers in older android versions by calling
android.telephony.TelephonyManager.getDeviceId().Alternatively, If you can get a unique id use this code