Home > front end >  Customising the default device access permission dialog in Android
Customising the default device access permission dialog in Android

Time:05-20

I have a business requirement wherein when user is working on his mobile phone and access my app then I need to show a single custom permission dialog to allow/deny the permission. Is it possible to overwrite the text of the default permission popup. I tried searching but everyone says its not possible, is it possible with latest Android API or is it still not allowed to customise the permission popup? I see everyone shows a disclaimer popup and then the default permission popup? Is this the only way?

Regards, Sajesh

CodePudding user response:

It is impossible and will never be possible!

If you could change the text, you could lie to the user about what permission you are requesting, and thus create malware.

What you can do, is display "rational text", a separate dialog explaining to the user why your application needs the specific permission.

How to show this explanation is entirely up to you, but to check if you need to show it, use this function: https://developer.android.com/reference/androidx/core/app/ActivityCompat#shouldShowRequestPermissionRationale(android.app.Activity, java.lang.String)

Note by the way, that if there is any overlay on the screen (also known as "floating widget" created by permission android.permission.SYSTEM_ALERT_WINDOW) the user will not be able to grant any permissions through popups or through settings app.

This is another security feature to make sure user isn't fooled by false text on a permission.

  • Related