android-permissions

Cannot resolve method “checkSelfPermission”

房东的猫 提交于 2020-01-01 05:50:14
问题 I am getting the error in the below code: if (ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { } The "checkSelfPermission" is always red indicating some kind of error. I have imported "import android.support.v4.content.ContextCompat;" already. The below is my build.gradle content: apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.xyz.user

Duplicate permission request after orientation change

和自甴很熟 提交于 2020-01-01 02:33:05
问题 Because the Android SDK 23 gives users the possibility to deny apps access to certain functionalities I wanted to update one of my apps to request permissions as it is described in here: https://developer.android.com/preview/features/runtime-permissions.html. In one of the activities I embed a SupportMapFragment. To make it work you need to have the WRITE_EXTERNAL_STORAGE permission, so I request it when I start the activity which results in a creation of a permission request dialog. Now the

Android location permissions

喜夏-厌秋 提交于 2019-12-31 11:41:53
问题 In my Android application I'm willing to use GPS locations . What are the main permissions that I should included in android manifest file in order to use GPS locations. In case of lost the GPS signal strength, is there any way to triangulate the position using mobile networks. Thank you! 回答1: The main permissions you need are android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION . Only fine location will allow you access to gps data, and allows you access to

Android location permissions

南楼画角 提交于 2019-12-31 11:41:52
问题 In my Android application I'm willing to use GPS locations . What are the main permissions that I should included in android manifest file in order to use GPS locations. In case of lost the GPS signal strength, is there any way to triangulate the position using mobile networks. Thank you! 回答1: The main permissions you need are android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION . Only fine location will allow you access to gps data, and allows you access to

How to deal with removal of a permission for a broadcast receiver in Android M?

拟墨画扇 提交于 2019-12-31 08:44:15
问题 I've got some legacy code which I am making permission safe for Marshmallow. There is a broadcast using the PHONE_STATE permission as follows: <receiver android:name="redacted.TheBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"></action> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> If the PHONE_STATE permission is granted but then later the user denied then when there is a phone call there is a

can't upload apk: READ_EXTERNAL_STORAGE with different maxSdkVersions

☆樱花仙子☆ 提交于 2019-12-30 10:33:30
问题 This is the first time I ask a question here. Anyway, as the title says, I'm trying to put my application on the market. When I try to upload the signed apk, I get the error: Upload failed Duplicate declarations of permission android.permission.READ_EXTERNAL_STORAGE with different maxSdkVersions. I tried searching through the existent questions, but I can't find a solution. ... <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission

Not all permissions in ACCOUNT permission group granted automatically

浪尽此生 提交于 2019-12-30 09:59:55
问题 In my app, I need the following permissions for creating an account: <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/> <uses-permission android:name="android.permission.USE_CREDENTIALS"/> It is my understanding that in the M, these should be granted automatically. However, what I'm seeing is that only GET_ACCOUNTS is granted. I've

FIleObserver and ContentObserver not working in Android Marshmallow

老子叫甜甜 提交于 2019-12-30 08:23:11
问题 I have issue with both FIleObserver and ContentObserver not working in Android Marshmallow. I am using this thing for detecting changes that happening inside a folder. I set run time permissions for marshmallow. But after that also it shows no events. It works perfectly in other versions. Please help me to solve this problem. First I tried Content Resolver inside Service for detect folder changes in background. public class TestService extends Service { @Override public void onCreate() {

Marshmallow Fingerprint Scanner Hardware Presence

落花浮王杯 提交于 2019-12-30 06:51:12
问题 I am looking to get started with the Marshmallow Fingerprint Authentication API. I understand that to ask for permission, I must use the following method: ContextCompat.checkSelfPermission(getContext(), Manifest.permission.USE_FINGERPRINT); And I must check if the device is running API level 23 or higher. But before I ask for permission, I would like to check if the device actually has a fingerprint scanner to begin with. I found the following two methods to do this check: FingerprintManager

Is there a way to check for manifest permission from code?

試著忘記壹切 提交于 2019-12-30 00:57:09
问题 How do I check for a specific permission in the manifest.xml from code? I want to throw some exception if some permissions that are necessay for my application are missing. For example , FINE_LOCATION and COARSE_LOCATION I know that android will also throw an exception on the launch of the specific activiy that is using GPS, but I need to check the manifest and throw an exception at the launch of the application itself. This holds not only for location access, but also for other permissions.