Skip to content Skip to sidebar Skip to footer

Permission Denial: Writing Android.support.v4.content.FileProvider Uri

Good day.I have an weird issue to which none of examples in stack overflow has worked.I am opening an gallery,after which i am redirecting user to crop intent.Important to mention

Solution 1:

List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        for (ResolveInfo resolveInfo : resInfoList) {
            String packageName = resolveInfo.activityInfo.packageName;
            grantUriPermission(packageName, photoURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
        }

Solution 2:

First, Android does not have a CROP Intent. There are many image cropping libraries available for Android. Use one.

Second, the first parameter to grantUriPermissions() is not an action string or some random series of characters. It is an application ID (a.k.a., package name). com.android.camera.action.CROP is not a package name.


Solution 3:

you should add this sentence: grantUriPermission(); like

this:grantUriPermission("com.google.android.apps.photos",cropedImageUri,Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

My error is like to u.I solve it by this.


Post a Comment for "Permission Denial: Writing Android.support.v4.content.FileProvider Uri"