Reputation: 178
I need to get an Android device's IMEI for authentication purposes. I'm aware that this is bad practice; we are currently working on a replacement system. For now, this is what I need (if it's even possible). All I can find are old questions that require READ_PHONE_STATE in the manifest, which I believe to be causing the issue. The code being called is:
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
and, later to get the IMEI:
telephonyManager.getDeviceId();
Is there any way to run this code without the above permission? Is there any other way to get the IMEI? Worst case scenario, I can put out a release with a SQLite update that hard-codes the value of each user and gets it form the db every time they need to make a request. This is feasible because there are only about a dozen users of the app, all internal employees. Is this is a better route to take? Thanks!
Upvotes: 0
Views: 560
Reputation: 494
There is only one way to get IMEI from Android 10. You need privileged permissions, which is impossible to get, if your app is installed through the Google Play.
There are different ways how to get unique ids, take a look at best practices in links below.
Please see:
Upvotes: 1