Using data from context providers or requesting Google Photos read permission?

后端 未结 6 1303
陌清茗
陌清茗 2020-12-05 07:34

My app allows users to import their photos and videos from other apps. Now that Google replaced Google+ Photos with Google Photos, couple of things broke for me. One of thes

6条回答
  •  忘掉有多难
    2020-12-05 08:04

    1. You can reproduce this SecurityException Log when you use the "Google Photo" app.

    2. Main cause of this problem is "Google Photo" shares ContentUri with fixed string like "content://com.google.android.apps.photos.contentprovider/1/1" and connect it with a static temporary values. "Google Photo" does not provide the file path when the actual Activity or Context which receives Intent.ACTION_SEND. Maybe, it is the policy of "Google Photo", not to expose the private image file to other app.

    3. For example, you defines 2 Activity in Manifest file, Actvity A and Activity B. Activity A for receives the Intent.ACTION_SEND. Activity B for processing the image file. Activity A forward the intent to Activity B. Then Activity B is not the correct Activity to "Google Photo", you encounters the SecurityException.

    So, I recommend you to save the file temporarily on Activity A and use the temporary file path on Activity B

提交回复
热议问题