Android securityexception permission denial opening provider

Permission denial: opening provider

I’ve created a custom content provider, which will be accessed by a few more applications. I’ve included the permission TAG in my provider AndroidManifest.xml file, and in the second application, I included the uses-permissions tag, but no success. Logcat shows me:

I’ve search on similar questions, but it seems like everything is correct. Any ideas ? Thanks .

Here is my provider AndroidManifest.xml file:

And this is my second application AndroidManifest.xml file:

4 Answers 4

The answer above was a litle confusing for me. But I got it now. I want to post my solution as well. Maybe for someone it’s more better to understand.

First App A is the App that has the SQLite-Database and the «Custom Content Provider». App B uses with a ContentResolver the databse from App A.

This is the AndroidManifest.xml-File from App A:

Ok and this is the AndroidManifest.xml-File from App B. Important is the part with «uses-permission»:

And the Code of the ContentProvider for App A looks like this:

And the Code for the ContentResolver from App B:

I hope this can help someone to understand it better.

but it seems like everything is correct

First, you really really really really really really should put a namespace on those permission names. Make them com.company.contentprovider.READ_DATABASE and com.company.contentprovider.WRITE_DATABASE .

Second, your android:readPermission and android:writePermission values need to use the android:name value from

Читайте также:  Лучшие расширения для firefox андроид

, not android:label . android:label is a display name only. So, the above snippet should be:

(though, bonus points for explicitly putting android:exported=»true» , which is a good idea)

Third, your other manifest does not use your old android:name , nor my suggested revised android:name , nor android:label , but something else entirely, where you elected to say that these are in the android.permission namespace, and they are not. This should be:

(though it is possible that com.company.contentprovider.WRITE_DATABASE will be sufficient — I don’t know if android:writePermission will automatically imply android:readPermission or not)

Make those changes, and I think you will have better luck.

Источник

java.lang.SecurityException: Permission Denial: opening provider androidx.core.content.FileProvider

So I’ve been making these 2 apps and I want app 1 to be able to send pdf files to app 2. They’re both signed with different keys as app 1 should be usable by any other apps as well.

The way I want it to work is as follows. App 2 sends a startActivityForResult to app 1 with an intent including a Uri with a file from App 2s fileprovider. Then app 1 should take the Uri and write the pdf onto the file provided by app 2. Then going back to app 2 the file should be written onto the file owned by app 2 in the first place.

Put simply the app 2 should provide a file where app 1 should write the pdf.

So I have it all set up like that but when trying to access the file to write to it, I get the java.lang.SecurityException: Permission Denial: opening provider androidx.core.content.FileProvider error message.

Full Error Message: Permission Denial: opening provider androidx.core.content.FileProvider from ProcessRecord <511cc8 14209:com.eureka.documentscanneru0a159>(pid=14209, uid=10159) that is not exported from UID 10155

Code to copy the pdf’s:

The security exception is always thrown on the pfdTo = cr.openFileDescriptor(to, WRITE_ACCESS); line.

Читайте также:  Ottplayer настройка андроид приставке

I’m 100% sure there is read and write access on the intent used to start the activity for result, and that there is read and write permissions granted on the external storage.

Any suggestions or help would be appreciated.

Источник

Permission Denial: opening provider android.support.v4.content.FileProvider

I was having some problem when trying to perform an application upgrade in Android emulator. The flow of the scenario is from an Activity, I will execute AsyncTask A which open up fragment A, then inside AsyncTask A, I will check if version upgrade is available.

If available and user selected «Okay» from fragment A, I will proceed to AsyncTask B to open up fragment B which show a message to user saying that upgrading is in process. In AsyncTask B doInBackground(), I will execute the install() and in onPostExecute(), I will show successful message.

In my AsyncTask B where I execute the install:

In my view model class:

However, when I execute the code above, no error message was shown and the version upgrade is not working as well. It basically just restart the intent and there is no upgrade at all.

It does not prompt me for the permission to install new version as well. Any ideas?

By the way, my android emulator is not rooted and therefore I could not use the «su» command approach.

EDIT

As suggestion by @Sagar, I changed my code above to:

And I am getting new error message from logcat:

The intent error message is telling me «There was a problem parsing package».

Источник

Caused by java.lang.SecurityException Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider #686

Comments

imandaliya commented Aug 14, 2020

Android : 9
Device : HUAWEI Y6s
Issue Occurred : more than 50 times with HUAWEI and Samsung devices

Caused by java.lang.SecurityException
Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord <31796d7 5910:com.ist.quotescreatoru0a150>(pid=5910, uid=10150) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

Читайте также:  Android sql delete all

android.os.Parcel.createException (Parcel.java:1953)
android.os.Parcel.readException (Parcel.java:1921)
android.os.Parcel.readException (Parcel.java:1871)
android.app.IActivityManager$Stub$Proxy.getContentProvider (IActivityManager.java:4159)
android.app.ActivityThread.acquireProvider (ActivityThread.java:6845)
android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider (ContextImpl.java:2922)
android.content.ContentResolver.acquireUnstableProvider (ContentResolver.java:1879)
android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java:1460)
android.content.ContentResolver.openAssetFileDescriptor (ContentResolver.java:1313)
android.content.ContentResolver.openInputStream (ContentResolver.java:1033)
com.yalantis.ucrop.task.BitmapLoadTask.copyFile (BitmapLoadTask.java:16)
com.yalantis.ucrop.task.BitmapLoadTask.processInputUri (BitmapLoadTask.java:57)
com.yalantis.ucrop.task.BitmapLoadTask.doInBackground (BitmapLoadTask.java:19)
com.yalantis.ucrop.task.BitmapLoadTask.doInBackground (BitmapLoadTask.java:2)
android.os.AsyncTask$2.call (AsyncTask.java:334)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.processTask (ThreadPoolExecutor.java:1187)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
java.lang.Thread.run (Thread.java:784)

The text was updated successfully, but these errors were encountered:

Источник

SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.MediaContentProvider that is not exported from uid 10063 #173

Comments

misaochan commented Jul 12, 2016

Posted by Tommy Gildseth on 12 Jul:

The text was updated successfully, but these errors were encountered:

misaochan commented Jul 12, 2016

Wow, there are an awful lot of bugs involving Google Photos, and my StackOverflow thread isn’t yielding any answers. 🙁

nicolas-raoul commented Jul 12, 2016

Linking it here for the sake of findability: http://stackoverflow.com/q/38301605

misaochan commented Jul 18, 2016 •

Oof, another Google Photos crash just showed up. :/ I’ve been reading up as much as I can on it, and the only solution I can find seems to require a major overhaul of how the image data is passed around.

Apparently it is due to a permissions change by the google photos provider:

For security reasons, the permissions are temporary, so once the client app’s task stack is finished, the file is no longer accessible. You must get the file data when you receive the intent answer, in the onActivityResult method. Store a copy of the file data, because the file won’t be available anymore when onActivityResult returns.

For the time being, should we tell people that our app has issues integrating with Google Photos?

Источник

Оцените статью