Android - Change READ_PHONE_STATE permission request message
Asked Answered
S

1

7

I'm using the Android Marshmallow READ_PHONE_STATE permission and I would like to change the text that appears on the permission request.

By default it shows:

Allow [App name] to make and manage phone calls?

But I'm using it to get the device id and the sim serial number, so I think is better to change the request message. Do anyone knows how to do it (some special function or something)?

Or I just have to implement an independent Dialog for that?

Thank you very much.

Superimposed answered 17/5, 2016 at 10:4 Comment(0)
N
7

No you can't change the text in the dialog. It is implemented by default in the system. You can provide a brief explanation regarding the permission before you ask for it. That way user will know exactly what you're going to use it for.

Request Permissions

If your app needs a dangerous permission that was listed in the app manifest, it must ask the user to grant the permission. Android provides several methods you can use to request a permission. Calling these methods brings up a standard Android dialog, which you cannot customize.

Explain why the app needs permissions

In some circumstances, you might want to help the user understand why your app needs a permission. For example, if a user launches a photography app, the user probably won't be surprised that the app asks for permission to use the camera, but the user might not understand why the app wants access to the user's location or contacts. Before you request a permission, you should consider providing an explanation to the user. Keep in mind that you don't want to overwhelm the user with explanations; if you provide too many explanations, the user might find the app frustrating and remove it.

One approach you might use is to provide an explanation only if the user has already turned down that permission request. If a user keeps trying to use functionality that requires a permission, but keeps turning down the permission request, that probably shows that the user doesn't understand why the app needs the permission to provide that functionality. In a situation like that, it's probably a good idea to show an explanation.

To help find situations where the user might need an explanation, Android provides a utiltity method, shouldShowRequestPermissionRationale(). This method returns true if the app has requested this permission previously and the user denied the request.

More details in the documentation

Noakes answered 17/5, 2016 at 10:10 Comment(1)
I supposed I couldn´t. Thanks for the link.Nurture

© 2022 - 2024 — McMap. All rights reserved.