Google allows the permission at run time and it allows the user to allow or deny the permission.
When user installs the app the permissions should automatically be ON, it should not be asked to user.
How can i get this functionality?
Thank you.
Google allows the permission at run time and it allows the user to allow or deny the permission.
When user installs the app the permissions should automatically be ON, it should not be asked to user.
How can i get this functionality?
Thank you.
It is not possible. If user not allow permission then app cant access resource related to particular permission. It is done by google for security purpose.
It is not possible to do so on marsh mallow, as it is fully based on runtime permissions.It increases users security.Your queries are supported only to Versions below marshmallow.Try having target version as 22 and run your app.
When user installs the app the permissions should automatically be ON, it should not be asked to user.
Have a targetSdkVersion
below 23. This is not a viable long-term solution, as eventually something will force your hand to have a targetSdkVersion
of 23 or higher.
You cite OlaCabs as an example of the behavior that you want. OlaCabs has a targetSdkVersion
of 22.
How can I set default permission in marshmallow so that if user sets off the permission manually and again when user opens the app the permission should be ON and the permissions should not be ask to user, it should be directly ON.
That is not possible. For example, with OlaCabs, after installing it but before running it, I revoked its rights to access contacts, location, phone, SMS, and storage. I then ran OlaCabs, and it crashed, because I had revoked its access to location data, and the authors of OlaCabs do not check to see whether they have permission first. OlaCabs does not magically cause those permissions to be re-granted.