Reputation: 6369
In app I want to get unique phone id via TelephonyManager.getDeviceId()
. To use this I need this permission READ_PHONE_STATE
. Problem is with runtime permission on Android 6. In runtime permission popup dialogue, it asks to grant permission "To make and manage phone calls" which can scary users from using app. What can be done? Or can I get any other unique identifier for device without using such big permission?
TelephonyManager TM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = TM.getDeviceId();
Upvotes: 13
Views: 17367
Reputation: 13451
I am using this as a unique device identifier in my app and i don't need any run time permission.
String android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
or You can use this
String uuid = UUID.randomUUID().toString();
Upvotes: 9