当我从brawser共享图像到我的Android应用程序时,我得到以下图像Uri 内容://com.android.chrome.FileProvider/images/screenshot/1507896426215620831996.jpg
<activity
android:name=".splash.SplashScreen"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SPLASHSCREEN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
现在为了获得该图像我正在使用以下功能
public static Bitmap getBitmapFromUri(Context context, Uri uri) throws IOException {
try {
ParcelFileDescriptor parcelFileDescriptor =
context.getContentResolver().openFileDescriptor(uri, "r");
FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
Bitmap image = BitmapFactory.decodeFileDescriptor(fileDescriptor);
parcelFileDescriptor.close();
return image;
} catch (Exception e) {
}
return null;
}
从Uri获取ParcelFileDescriptor时遇到异常 java.lang.SecurityException:Permission Denial:从ProcessRecord {c57dcea 3162:com.slocamo.ucee / u0a246}(pid = 3162,uid = 10246)打开提供者org.chromium.chrome.browser.util.ChromeFileProvider uid 10111
当我使用另一个brawser时,情况也是如此。知道出了什么问题吗?