Go to My app's App Permission screen - android

Is there an Intent to go to my Application's "App Permissions" screen in Android-M?
I am making my App ready for Android-M and with the new permissions model. I have followed all the steps mentioned in the link
https://developer.android.com/training/permissions/requesting.html
Everything is set and all is good accept that if the user has checked the "Never ask again" button and denied permission, on next launch I want to give the user an option to go to the Application's "App Permissions" and change the permission himself, if he ever changes his mind. I wanted to make it a bit easier for the non-tech savvy user by providing a button which would take the user straight to my application's "App Permissions" screen. Is there a way? (It would be much better than giving the user instructions like Menu → Settings → Applications → Manage Applications → select application)
Thank you for helping out!

No, there is no intent to go directly to the Permissions screen.
However, just as in previous versions of Android, you can point people to your application's detail setting page using code such as:
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
This will allow them to only hit a single button (the Permissions button on that screen) before they can access permissions.
Note that as per the UX around asking for permissions, consider linking to the settings page only as a last resort and only in cases where the permission is necessary for your app to function at all - ideally, you should show a strong rationale when shouldShowRequestPermissionRationale() returns true (i.e., they've denied it once but have not hit 'never ask again') such that the second time the user sees a permission dialog they know exactly why you need that permission. This means that users hitting 'never ask again' should be considered a very strong signal that the user will not ever grant you that permission.

Unfortunately this is not possible, however, as every other app does we can open the app's settings page so the user can grant the necessary permissions manually from there.
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", packageName, null)
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)

Related

How to distinguish "Never ask again" state and "Canceled" state for Android runtime permission?

User can cancel a permission request by hitting the "Back" button. And since Android 11, user can also clicking on the outside of the permission dialog to cancel. When a permission is canceled, the permission is not granted, and shouldShowPermissionRationale() will return false, which means app can call requestPermissions() again.
When user choose "Don't ask again", or deny twice for a permission in Android 11, shouldShowPermissionRationale() will also return false. But how can I distinguish "Don't ask again" from the "Canceled" state?
I need to distinguish these two states is because that if user canceled a permission before, I know that I still have the chance to prompt the system permission dialog to them. But if user choose not to ask for a permission again, I need to guide them to the app info page to grant the permission manually.
It's not a direct solution to this problem because there appears to be no way to get that.
However, I have realised that there is a method where Android will tell us if we need to show RationaleDialog to our user without any work from our end (before I was under impression we need to keep track of this ourselves).
Just call activity.shouldShowRequestPermissionRationale(permission) and it will take care of all back calls itself.

Create accessibility service for granting/revoking permissions of other applications available on android phone

I have created an app which lists the all applications available on my device.
Clicking on a specific app displays the permission associated with it.
I have done this using the package name of the specific app.
The Permissions are sorted with a switch button.
Switch checked shows the particular permission is granted and vice versa.
Upon changing the switch and clicking on Apply changes(Button residing at the bottom of the page)user should be able to change the permission of the application.
For this I have read an accessibility service would be a better option.
I have searched many things available and i have learnt that navigating through a particular application settings ---> permission screen and reading the window content available and using the button action of the accessibility service things can be done.
But the first and foremost thing is navigating to the settings --> Permission is quiet tricky.
As per this How to programmatically open the Permission Screen for a specific app on Android Marshmallow?
In stack overflow I have found answer suggesting the navigating through the permission is impossible but I have seen apps which directly takes you to the permission screen.
For example : Files go by google
Files Go
But I am unable to create an accessibility service which can read the settings ---> permissions of a particular app and change the permissions.
To open settings page
Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);
iam trying to develop app similar to this app -
Permission Manager
Any help would be appreciated . Thanks in advance
Any doubts related to question i will respond immediately.please comment below .
please do not mark as closed or unclear what iam asking. Iam ready to explain if the question is not understandable.

Android 6.0 Permission Checks for reading TELEPHONE ACCESS

Is it possible to ask repeated prompt to the user,when the user provides deny in the permission(READ_PHONE_STATE) request pop up raised by shouldShowRequestPermissionRationale().
Once I Click on deny the prompt gets exited and my objective is to make him click only Allow.Is this achievable in android 6.0 Version ?
No, if the user wants to Deny permission they will always have that option. Its up to the developer to deal with that situation.
shouldShowRequestPermissionRationale is just a hint for you, you can choose the ignore the method's return value, or choose not to call that method at all.
If you have a permission you must have for the app to function properly, you should pop a dialog explaining this in simple language to the user, and keep asking for the permission until (a) the user gives you the permission, or (b) the user decides to uninstall the app.

Android 6 Marshmallow Black Screen after set Permission to Never Ask Again

I have got this really weird behaviour.
After adding the permissions at runtime for my app, I was checking and testing all cases.
I have the request code in my MainActivity.
So, after I set Never Ask Again and deny the giving permission for ACCESS_FINE_LOCATION, if I press the menu button and then restart the app (the app will call onResume of MainActivity I guess), then the screen is black except a rectangle part in the middle of the screen which varies in size. (Is not the AlertDialog size)
Here some screenshots:
Normal screen
After press menu and then open again can be that it opens with the normal state or with these states:
Or
This is quite weird, anybody had this before?
Thanks for your answers!
Without seeing the code, it's hard to give a very accurate answer.
When requesting permissions, if the user selected 'never ask again', the request permissions response will be denied. I'm GUESSING (due to lack of code) that your app relies on the granted permission to continue loading the UI and executing more code, which it won't do if permission is denied. You need to handle all possible responses when requesting runtime permissions.
if permission is granted: good to go
if permission is denied: check if you should show the permission rationale. This means you display a message to the user explaining why you need the permission.
if shouldShowRationale is true: it means 'never ask again' was NOT checked. Display the message, then ask for permission again.
if should show Rationale is false: it means 'never ask again' was checked and you should probably direct the user to the app settings to turn the permission on if it's required.

Android limit CALL_PHONE permission to avoid hidden calls

The Android docs for the CALL_PHONE permission reads:
"Allows an application to initiate a phone call without going through the Dialer
user interface for the user to confirm the call being placed."
Also this message is prompted to the user when he installs the app.
Reading that the application may start hidden calls can possibly discourage installation for some users.
Since my app does NOT start hidden calls, I wonder if there is a way to limit this behaviour, possibly with a more strict permission, to avoid displaying that dreadful message to the user.
Here is my corrected solution:
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:" + 1234));
startActivity(callIntent);
This doesn't require any permissions and just open the dialer. Should be exactly that what you were looking for.
I don't think it's possible. There are 2 permissions associated with phone calls (CALL_PHONE, CALL_PRIVILEGED) with CALL_PHONE being the less restrict one. Google Play will always show that discouraging description for any application holding these permissions.
If this permission is really important for your application, leave it as it is. But opening the dialer instead of calling is a much better option for the user experience (In most of the cases), so try using it instead (You said you're notifying the user anyway... So why can't you show the dialer instead of that notification?)

Categories

Resources