Android Permissions: Phone Calls: Read Phone State and Identity

Android permissions: Phone Calls: read phone state and identity

(Answering my own question in case anyone else runs into this problem and searches for it.)

Digging around in PackageParser.java in the android source, I found out that the system will automatically assign

android.permission.WRITE_EXTERNAL_STORAGE and 
android.permission.READ_PHONE_STATE

to any app that declares a targetSdk version of less than 4 (donut). There must be a compatibility reason for this, maybe apps targeting older versions could assume they had these permissions without declaring them explicitly. So, if you don't want these permissions added to your app implicitly, add a section like the following in AndroidManifest.xml

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" />

That is all.

Have fun, -Mike

Android READ_PHONE_STATE runtime permission asks to make and manage phone calls

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();

How to avoid READ_PHONE_STATE Android permission

You don't need the device identifier for push, you just need the push key in which case getDeviceId() or similar calls are never made. If you follow the push tutorial there won't be any permission for phone state within your app.

which one of these permissions in manifest says I'm reading phone call information?

It turned out to be an issue with a bug where you need to at least specify a minimum SDK of 4:

Android permissions: Phone Calls: read phone state and identity

Android READ PHONE STATE permission

ActivityCompat.requestPermissions() is asynchronous. It returns control to you immediately. You do not yet have the permission.

Move all that stuff that appears after the ActivityCompat.requestPermissions() call into a separate method (which I will call here foo()). Then:

  • If checkSelfPermission() shows that you have the permission, call foo()

  • If checkSelfPermission() shows that you do not have the permission, in your onRequestPermissionsResult() method, if you now have the permission, call foo()

  • If in onRequestPermissionsResult(), you still do not have the permission (e.g., the user denied your request), deal with it somehow

Android READ PHONE STATE?

I did not see <uses-permission android:name="android.permission.READ_PHONE_STATE" /> in your Manifest file.

It is required for your application to be able to read that state.



Related Topics



Leave a reply



Submit