Questions tagged [android-permissions]

Permissions in the AndroidManifest.xml that allows an app to perform certain actions that are disallowed by default

3946 questions
669
votes
15 answers

What permission do I need to access Internet from an Android application?

I get the following Exception running my app: java.net.SocketException: Permission denied (maybe missing INTERNET permission) How do I solve the missing permission problem?
Janusz
  • 187,060
  • 113
  • 301
  • 369
448
votes
15 answers

How can I programmatically open the permission screen for a specific app on Android 6.0 (Marshmallow)?

I have a question regarding the new Android 6.0 (Marshmallow) release. Is it possible to display the "App Permissions" screen for a specific app via an Intent or something similar? It is possible to display the app's "App Info" screen in Settings…
411
votes
36 answers

Exception 'open failed: EACCES (Permission denied)' on Android

I am getting open failed: EACCES (Permission denied) on the line OutputStream myOutput = new FileOutputStream(outFileName); I checked the root, and I tried android.permission.WRITE_EXTERNAL_STORAGE. How can I fix this problem? try { …
Mert
  • 6,432
  • 6
  • 32
  • 68
372
votes
29 answers

Android M - check runtime permission - how to determine if the user checked "Never ask again"?

According to this: http://developer.android.com/preview/features/runtime-permissions.html#coding an app can check for runtime permissions and request permissions if it hasn't been granted already. The following dialog will be displayed then: In…
Emanuel Moecklin
  • 28,488
  • 11
  • 69
  • 85
312
votes
25 answers

Android M Permissions: onRequestPermissionsResult() not being called

I'm updating our app to use the new M runtime permissions system. It's all working except for onRequestPermissionsResult(). I need to check a permission on a button press, and if it's successful, send a text message. When I grant permission to do…
Ayohaych
  • 5,099
  • 7
  • 29
  • 51
250
votes
5 answers

Permission Denial: startForeground requires android.permission.FOREGROUND_SERVICE

Lately we have suddenly been seeing a few of the following stack traces. Why could that be? This is from when the app tries to move an audio commentary service into the foreground with a media notification and…
Roy Solberg
  • 18,133
  • 12
  • 49
  • 76
202
votes
26 answers

Android marshmallow request permission?

I am currently working on an application that requires several "dangerous" permissions. So I tried adding "ask for permission" as required in Android Marshmallow(API Level 23), but couldn't find how to do it. How can I ask for permission using new…
Nilabja
  • 4,206
  • 5
  • 27
  • 45
195
votes
23 answers

Android 6.0 multiple permissions

I know that Android 6.0 has new permissions and I know I can call them with something like this if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { …
190
votes
12 answers

Android permission doesn't work even if I have declared it

I'm trying to write code to send an SMS from an Android app, but when I try to send the SMS it sends me back the error: 09-17 18:37:29.974 12847-12847/**.**.****E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: **.**.****, PID:…
Nathan Loudjani
  • 2,056
  • 2
  • 11
  • 11
160
votes
13 answers

How to detect incoming calls, in an Android device?

I'm trying to make an app like, when a call comes to the phone I want to detect the number. Below is what I tried, but it's not detecting incoming calls. I want to run my MainActivity in background, how can I do that? I had given the permission in…
Jesbin MJ
  • 3,219
  • 7
  • 23
  • 28
130
votes
5 answers

WRITE_EXTERNAL_STORAGE when targeting Android 10

There is a lint warning in AS with regards to android.permission.WRITE_EXTERNAL_STORAGE. The warning says that the permission will no longer provide write access when targeting Android 10 and above. Removal of the said permission can still write in…
Mihae Kheel
  • 2,441
  • 3
  • 14
  • 38
124
votes
16 answers

How to check permission in fragment

I want to check a permission inside a fragment. my code: // Here, thisActivity is the current activity if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) !=…
S.M_Emamian
  • 17,005
  • 37
  • 135
  • 254
108
votes
5 answers

How to request permissions from a Service in Android Marshmallow

In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only…
100
votes
4 answers

If I have ACCESS_FINE_LOCATION already, can I omit ACCESS_COARSE_LOCATION?

I have a GPS app that already requests ACCESS_FINE_LOCATION permission in the manifest, now I want to add a library (MoPub) that requires ACCESS_COARSE_LOCATION. Am I correct in assuming that ACCESS_FINE_LOCATION is enough, and I can leave out…
charliefortune
  • 3,072
  • 5
  • 28
  • 48
99
votes
5 answers

SYSTEM_ALERT_WINDOW - How to get this permission automatically on Android 6.0 and targetSdkVersion 23

Facebook, Evernote, Pocket - all apps get this permission on Android 6.0 automatically, even though they are targeting 23 (targetSdkVersion=23). There has been a lot of documentation regarding the new Marshmallow permission model. One of them is…
1
2 3
99 100