Good day i was wondering if the user grants an application access to the ACCESS_FINE_LOCATION permission if that application would also automatically have access to the ACCESS_COARSE_LOCATION API methods
As you can see in the LocationManager API and in an older version of the guide:
If you are using both NETWORK_PROVIDER and GPS_PROVIDER, then you need
to request only the ACCESS_FINE_LOCATION permission, because it
includes permission for both providers. (Permission for
ACCESS_COARSE_LOCATION includes permission only for NETWORK_PROVIDER.)
In short: yes, you are allowing to ACCESS_COARSE_LOCATION if you've already defined ACCESS_FINE_LOCATION.
According to this post, after publishing in Play Store for Android 6 device the SYSTEM_ALERT_WINDOW permission has to be given automatically.
Here it's shown that my App has permission to draw over other apps.
But after downloading from Play Store it is not provided automatically.
I have announced SYSTEM_ALERT_WINDOW only in AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
What else can I do to make users receive the SYSTEM_ALERT_WINDOW permission automatically after downloading the app from an app store? Is there any chance that the Play Store will block me and not grant the ability to get the permission automatically?
As per Android Guideline user need grant permission if they have device with android version Marshmallow and up. I have followed instruction given here for my application.
I have declared two permission in my application called WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE in my manifest file. I am little confused in
Permission Group
I have asked permission of WRITE_EXTERNAL_STORAGE, I still need ask permission READ_EXTERNAL_STORAGE or it may automatic granted when user grant WRITE_EXTERNAL_STORAGE permission ?
I need to display request permission (Read external storage) at run time. without the permission my app crash instantly.
In API 14 you don't need to do a request.
Just put in your manifest above <application> section:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Requesting permissions at run time is not supported with API level 14, it isn't supported until API level 23.
If you're running your app from Android Studio on a device or emulator where the app is already installed, your app will not ask for permission when it runs. If you inadvertently remove the permission you will need to manually grant the permission through the Application Manager on the device or emulator.
To prevent the initial crash, you could wrap the offending call in a permissions check.
if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
// READ DATA
}
Hope this helps!
Since Runtime Permissions were introduced in Android Marshmallow, I've been meaning to apply the new way for requesting permissions and I've read and understood the dangerous permissions and how to check for them and request them.
The question is, If I have an Activity that contains a Button for opening Camera.
Do I check and request the permission when the Activity is opened? Or when the button is clicked?
Please explain why your suggested way is preferred.
Do I check and request the permission when the Activity is opened? Or when the button is clicked?
If the only purpose of the Activity is to take a picture when the button is clicked, I would request the permission when the activity is opened.
If the Activity has other roles, such that the take-a-picture button is only one feature out of many, I would ask for the permission when the user clicks the button.
In other words, once the user has requested to go down a path that will (almost) certainly need the permission, ask for the permission.
According to me, when click on button ask for permission to open camera.
because activity can have many component which can request for like camera, contacts, write storage, etc
so you must not ask for permission when activity opens but when you click on button ask for camera permission
if you want to send SMS than ask when you need to send not at opening of activity.
Permissions Best Practices.
You can download official sample app here.
hope you get it.
Starting from Android SDK 23, system permissions are divided into two categories, normal and dangerous:
Normal permissions do not directly risk the user's privacy. If your
app lists a normal permission in its manifest, the system grants the
permission automatically.
Dangerous permissions can give the app access to the user's
confidential data.
If your app lists a normal permission in its manifest, the system grants the permission automatically. If you list a dangerous permission, the user has to explicitly give approval to your app.
For more information, see Normal and Dangerous Permissions.
If your app targets API 23, and you need to ask user for a dangerous
permission (such as READ_CONTACT or READ_CALL_LOG etc.), you need to
ask for permission in runtime.