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 everything. java.lang.SecurityException: Permission Denial: startForeground from pid=1824, uid=10479 requires android.permission.FOREGROUND_SERVICE at android.os.Parcel.createException(Parcel.java:1942) at android.os.Parcel.readException(Parcel.java:1910) at android.os.Parcel.readException(Parcel.java:1860) at … Read more

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 it, the dialog closes, but it doesn’t trigger the Send Text until I … Read more

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 case the user declines an important permission, imo an app should display an explanation why the permission is needed and what impact declining has. That dialog has … Read more

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 { InputStream myInput; myInput = getAssets().open(“XXX.db”); // Path to the just created empty db String outFileName = “/data/data/XX/databases/” + “XXX.db”; // Open the empty … Read more

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 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 an analog solution for directly opening the permission screen? startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts(“package”, … Read more

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? 14 s 14 Add the INTERNET permission to your manifest file. You have to add this line: <uses-permission android:name=”android.permission.INTERNET” /> outside the application tag in your AndroidManifest.xml