Questions tagged [android-permissions]

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

3368 questions
623
votes
14 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
  • 176,216
  • 111
  • 293
  • 365
366
votes
13 answers

How to programmatically open the Permission Screen for a specific app on Android Marshmallow?

I have a question regarding the new Android Marshmallow release: Is it achievable to display the Permission Screen for a specific app via an Intent or something similar? It's possible to display the app settings with the following code - is there…
359
votes
34 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
  • 5,728
  • 6
  • 28
  • 60
335
votes
26 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
  • 25,943
  • 11
  • 66
  • 78
304
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…
AndyOHart
  • 4,813
  • 7
  • 23
  • 45
229
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
  • 14,329
  • 9
  • 39
  • 68
179
votes
24 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
  • 3,867
  • 5
  • 24
  • 40
178
votes
13 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
  • 1,926
  • 2
  • 9
  • 10
169
votes
22 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) { …
144
votes
10 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
  • 2,939
  • 5
  • 21
  • 27
105
votes
9 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
  • 14,509
  • 24
  • 98
  • 193
102
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…
93
votes
2 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
  • 2,450
  • 2
  • 20
  • 41
85
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…
82
votes
2 answers

List of Android permissions normal permissions and dangerous permissions in API 23?

Which permissions need for requesting permissions at run time of API 23?
1
2 3
99 100