Igor Tyulkanov
Igor Tyulkanov

Reputation: 5548

Why I can not customize permission request dialog on Android 6?

Recently, I met a lot of questions about permission request dialog on new Android Marshmallow. They sound like:

How can I customize Android permission dialog?

How can I provide custom text to Android permission dialog?

Why I can not customize Android permission dialog?

So here is the full answer for all of this questions.

Upvotes: 1

Views: 3151

Answers (1)

Igor Tyulkanov
Igor Tyulkanov

Reputation: 5548

Here are other similar questions:

Android M - custom permission dialog style

How can i customize permission dialog in android?

Provide custom text for Android M permission dialog

First of all You can't make any customization for Android permission dialog, because it's system dialog:

When your app calls requestPermissions(), the system shows a standard dialog box to the user. Your app cannot configure or alter that dialog box. If you need to provide any information or explanation to the user, you should do that before you call requestPermissions(), as described in "Explain why the app needs permissions".

But many people ask the one same question - Why?

The answer is very simple, because you can trick the user. I will give an example.

  1. If you want to provide your own dialog for getting permission, obviously you can provide incorrect or misleading information to user about what you need.
  2. If you want to provide only your own text for that dialog, you can do the same thing like on previous item. But you can ask why I can't provide additional information together with the system one? Again, because you can trick the user. You can provide very long text and block of basic information can go beyond the screen or you can find the parent container through you own custom view and hide it.
  3. If you want to style this dialog through system xml styles you can create white text on white background e. g. and trick the user again.

And it is only those variants that immediately come to mind. It is quite obvious that any interference could be used to harm.

Upvotes: 5

Related Questions