Permission dialog is not showing in version 5.0 - android

android permission dialog is not showing in lollipop version I.e 5.1, but permission dialog is showing in version 6.0 ie marshmallow. Can any one tell me what is the reason behind this, and how to solve this problem.

For below Android 6.0 permission dialog will not shown to the user.
From Android Docs:
If the device is running Android 5.1 or lower, or your app's target SDK is 22 or lower: If you list a dangerous permission in your
manifest, the user has to grant the permission when they install the
app; if they do not grant the permission, the system does not install
the app at all.
If the device is running Android 6.0 or higher, and your app's target SDK is 23 or higher: The app has to list the permissions in the
manifest, and it must request each dangerous permission it needs while
the app is running. The user can grant or deny each permission, and
the app can continue to run with limited capabilities even if the user
denies a permission request.

Can any one tell me what is the reason behind this
Assuming that you mean the runtime permission dialog triggered by requestPermissions(), the reason is that this dialog exists only on Android 6.0+. ActivityCompat.requestPermissions(), ContextCompat.checkSelfPermission(), and related methods call their native equivalents on Android 6.0 devices and fail gracefully on older devices.
how to solve this problem.
There is no problem. Runtime permissions only exist on Android 6.0+. On Android 1.0-5.1 devices, permissions are granted purely at install time.

Related

Enable all notifications permissions in Android

At least in my two xiaomi's phones when I install my app, it doesn't have all notifications permission (only vibrate, badge and lock screen) like in the pic.
What can I do to in my app to have all the notification permissions enabled by default?
Thanks!
Starting from android 6.0 marshmallow you need to manually give permissions for security reasons. If the application isn't written in such way that it checks for permissions and asks for them, then you can't get them enabled by default(without going to settings).
You need to manually ask for permission for Android 6.0 and above. More informations :
Request App Permissions

Android Runtime permissions in marshmallow for Android Camera application

In Android marshmallow android introduced runtime permissions.
Here my question is Do Android system application such as Camera, Phonebook need to ask for permission like any other non system applications.
Does android system application have some privileges.
Thanks
If you are going to run system applications (by Intent), then you must request the appropriate permissions, except Normal Permissions.
NOTE. And you must remember that the user can at any time revoke the granted permissions.

android requesting permission I'm not asking for

In my android manifest I never request for the permission to allow my app to record audio however when I run my app on a Galaxy s7, there is a pop up asking for such permission.
The weird thing is this only happens when I run on an s7, if I run my app on an s6 it does not request permission to record audio.
Would anyone know why it is requesting permission to record audio when I never included it in my android manifest and why its only happening on an s7 and not an s6.
Thanks
Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen
Requesting Permissions at Run Time
The weird thing is this only happens when I run on an s7, if I run my app on an s6 it does not request permission to record audio.
Basically this happens because your s7 device may have lollipop or higher android version . and s6 has lower API level (<23);
Thanks to CommonsWare in the comments for posting that link, helped me solve the problem.
Basically what I did was add
uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove"
to my manifest file and it stopped asking for permission.

Issue in restrict disabling permissions for android marshmallow and later

I am developing an app that does some admin operations on android devices.
The users of android devices running on marshmallow and later has the ability to disable or enable the permissions for a particular app, and I want to restrict the user from disabling my app's permissions since it is an admin app and it need the permissions to run the app.
Is there anyway to restrict enabling/disabling permissions particularly for apps with device administrator privileges?
You Cannot restrict a user from enabling and/or disabling permissions on devices above Marshmallow.
The Only thing you can do is just check if the user has disabled the permission then either explain him why your app needs the permissions and if he is still not giving permissions then don't let him enter the app.
You can check at start of app whether the user has disabled your permission using
ContextCompat.checkSelfPermission(context, permission);
It will return -1 if the permission is not available.
No, This is not under the legal standard of android,
you have to check permission on your app at Splash or First Screen that your app has access that permission or not for move further.

Is it possible to grant Nearby API permissions from phone settings?

Question
Is it possible to grant Nearby API permissions from phone settings?
If so, how?
Does the answer vary by device API level?
Read on for more context if needed :)
General Background
When an app targeting API level 23 or higher is installed on a device running API level 23 or higher, access to actions that required dangerous permissions can be granted or revoked by the user in two different ways:
while the application is running in the foreground, where calls to requestPermissions result in the user being shown a prompt;
from the Settings -> Apps screen, where users can grant/revoke access to actions requiring dangerous permissions on a app-by-app or group-by-group basis.
In particular, a user who has denied a permission that has been requested (at least) twice via mechanism #1, and who has checked 'Never ask again' in the most recently-displayed prompt:
can still choose to grant that permission at a later time using mechanism #2.
Nearby API Background
When an app wishes to use the Nearby Messages API, a mechanism similar to (but distinct from) #1 can be used to request the necessary permissions at runtime. As far as I can tell, these permissions are not represented within any of the standard dangerous permissions groups.
Just like for typical dangerous permissions, it is possible for a user to instruct an application to 'Never ask again' for the Nearby API permission (example from Pocket Casts; device running API 23):
However, if a user selects this option it would appear to be totally permanent. Here are the listed permissions groups for Pocket Casts immediately after denying access to the Nearby APIs with 'Never ask again' checked:
The only dangerous permissions group present is Storage, and access is still granted. There's no sign of the Nearby API permissions, and I therefore don't see how it is possible to ever grant access to these permissions after reaching this state... (apart from uninstalling and reinstalling the application, which isn't ideal!)
Edit
In more recent testing I seem unable to permanently deny the Nearby permission. Even after the first denial, the "Never ask again" checkbox does not appear. I am guessing this was introduced by a change in the Google Play Services version running on my phone. Here's what the permissions dialog looks like now. Note that it includes specific instructions related to locating the Nearby permission setting!
As pointed out by Morrison Chang in the comments, Nearby API permissions control is located under Settings -> Google. Here's an animated gif showing how to grant access to the Nearby APIs on an app-by-app basis, starting from the settings screen of a Nexus 6 running Marshmallow:
As a developer, this makes sense to me in hindsight - it's the only way Nearby permissions management could be backported to pre-Marshmallow devices. As a user, though, I definitely found this confusing!

Categories

Resources