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();
Some apps require access to calls to provide you the best possible service by having full access to call data. Be aware that most of these apps will keep your data safe.
It's the “dangerous” permissions that Android requires your permission to use. These “dangerous” permissions include access to your calling history, private messages, location, camera, microphone, and more.
READ_PHONE_STATE is one of the Android permissions categorized as dangerous. This is because it “allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any Phone Accounts registered on the device” [2] .
Use of the broad package (App) visibility (QUERY_ALL_PACKAGES) permission. Google Play restricts the use of high-risk or sensitive permissions, including the QUERY_ALL_PACKAGES permission, which gives visibility into the inventory of installed apps on a given device.
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With