我的下一个问题:我的应用通过清单中的意图过滤器从 Google Photos 接收图像
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
<data android:mimeType="image/*" />
</intent-filter>
然后我得到这样的uri:
mSharedImageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
然后我将事件发送到 Fragment 并使用此 Fragment 启动另一个 Activity,该 Fragment 接收到带有共享图像 uri 的事件。请求“READ_EXTERNAL”权限,授予权限后
getContentResolver().openInputStream(uri)
用于获取Exif数据,目前我得到下一个:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=75542, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.my.app/com.my.app.activities.Activity}: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{be2762c 9157:com.my.app/u0a931} (pid=9157, uid=10931) that is not exported from uid 10086
at android.app.ActivityThread.deliverResults(ActivityThread.java:3940)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3983)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1548)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{be2762c 9157:com.my.app/u0a931} (pid=9157, uid=10931) that is not exported from uid 10086
但是,如果在第一个 Activity 上请求许可或此时授予许可,则一切正常。你能给我一个建议吗?它是在较早的时候工作的,例如大约在一个月前。