Questions tagged [runtime-permissions]

This tag refers to Android runtime permissions introduced with Android 6.0 Marshmallow (API level 23). Previously permissions were granted on installation of an app. As of API level 23 permissions need to be requested at runtime.

Runtime permissions for Android were introduced in version 6.0 Marshmallow (API level 23).

The permissions are categorized into different protection levels and groups. For the dangerous level the permission must be requested at runtime, in contrast to normal permissions that are granted at install time. The user can revoke a previously granted permission anytime.

See also:

315 questions
9
votes
0 answers

How do I create test assets and grant runtime permissions in androidTest tests?

Before you mark this as duplicate, please note that this isn't about granting permissions to the app under test, but the test apk itself. In my app, there's functionality that takes a file from the Download dir (/sdcard/download), validates it, and…
copolii
  • 14,208
  • 10
  • 51
  • 80
9
votes
6 answers

surface view does not show camera after i gave permission

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_camera, container, false); cameraId = Camera.CameraInfo.CAMERA_FACING_BACK; …
Velayutham M
  • 1,119
  • 14
  • 18
9
votes
2 answers

Where is permissions in Android stored?

The developer doc: Requesting Permissions at Run Time clearly mentions what runtime permission is and how to use it. And I am able to execute them as well. However, the question is : where does Android store the run-time permission values? ie, when…
OBX
  • 6,044
  • 7
  • 33
  • 77
9
votes
2 answers

How to prevent Re-creating an Activity while changing the permissions at runtime in Android M or above

My app uses location permission. If this permission is revoked at runtime from App Settings and coming back to app, the current activity is destroyed and recreated. How to prevent the recreation of that activity?
9
votes
2 answers

Android runtime permission for system apps

Question about Android runtime permissions. AFAIK, android grant dangerous permission at runtime. I reset my phone, then adb pull /data/system/users/0/runtime-permissions.xml, I found android.ui.system has already granted many dangerous permissions.…
user1890874
  • 283
  • 1
  • 2
  • 9
9
votes
6 answers

Espresso - click on the button of the dialog

I want to test the permissions of Android 6, but I didn't find the way to click on the "Allow" button using Espresso. Is there a way to do this? The version of Espresso is 2.2.1. The test: @Test public void acceptFirstPermission() throws…
8
votes
2 answers

Android : Webcam Error in WebView (Camera Permission not working)

I have created WebView Activity and loading https://web.doar.zone/coronavirus This URL required Camera permission which I had taken Runtime Permission in Android. Here is the full code of MainActivity.java: public class MainActivity extends…
8
votes
5 answers

Android runtime permission is GRANTED but still denied

I'm trying to write an app that sends SMS. When checking if I have the required permissions it returns true but still crashes with SecurityException. When button is pressed private void startAutoMsg() { Log.d("Starting Auto Msg"); //FIXME:…
amoz871
  • 81
  • 1
  • 5
8
votes
1 answer

Android ID as an alternative to Device ID

My apps have always used DeviceId as a unique identifier and this, of course, requires READ_PHONE_STATE as a permission. That has been ok in the past but now I have migrated to Marshmellow 23 where asking for this permission displays a very scary…
Dean Blakely
  • 3,535
  • 11
  • 51
  • 83
8
votes
1 answer

targetSdkVersion 23 returns 0 length array via accountManager.getAccounts()

I observed the following strange outcome in my real Nexus 5 device, Android 6.0.1 I run the following simple code during my app launched. Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+ AccountManager accountManager =…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
8
votes
4 answers

Is the request for internet persmission required at runtime (Android)?

For Android, it is required that we ask permissions at runtime to make sure users understand better why en when permissions are needed. I know this is true for permissions like WRITE_CALENDAR and ACCESS_FINE_LOCATION but it seems it's not required…
8
votes
6 answers

How to forget the "Never ask again" choice in Android M runtime permission dialog

I wish to know where the "Never ask again" checkbox boolean flag is stored and how to clear its value? Not necessarily programmatically, but manually - via setting, command or some tool. Tried clearing app data, uninstall, both uninstall and clear,…
WindRider
  • 11,958
  • 6
  • 50
  • 57
7
votes
0 answers

SecurityException: Unsupported path /storage/emulated/999/Download/somefile.pdf

I am trying to download some .pdf file from the server to download folder This exception is thrown randomly on some device Xiomi running android (8,7,6) : 97% crashes only in this device Storage runtime permission have been given and it works What…
karthik kolanji
  • 2,044
  • 5
  • 20
  • 56
7
votes
2 answers

Runtime permission: shouldshowrequestpermissionrationale always returns false

Below is my code, i called this code for getting runtime permission. In this case the "shouldshowrequestpermissionrationale always returns false". I cannot find a solution why it is goind like this. Due to this the run time permission alert not…
Viswa Sundhar
  • 121
  • 3
  • 16
7
votes
1 answer

Surfaceview is not creating immidiately after asking for runtime permission

I am stuck with this issue of Surfaceview and runtime perssion, I have requirement of showing the camera preview using the Surfaceview at a main activity, So i am asking for the runtime permission when i call the code to show the camera preview. But…
Hardik Chauhan
  • 2,750
  • 15
  • 30
1
2
3
20 21