[expo-sharing] Fixed sharing external URIs on Android (#9223)# Why Fixes #9222. # How According to [Android docs](https://developer.android.com/reference/androidx/core/content/FileProvider#Spe
[expo-sharing] Fixed sharing external URIs on Android (#9223)# Why Fixes #9222. # How According to [Android docs](https://developer.android.com/reference/androidx/core/content/FileProvider#SpecifyFiles), `FileProvider` should have added `external-files` path in order to be able to access locations like `DCIM` or `Downloads`. I added that line to `[sharing_provider_paths.xml](https://github.com/expo/expo/blob/master/packages/expo-sharing/android/src/main/res/xml/sharing_provider_paths.xml)`. That fixed the issue, but after that I encountered following exception in Android Studio only: ``` E/DatabaseUtils: Writing exception to parcel java.lang.SecurityException: Permission Denial: reading expo.modules.sharing.SharingFileProvider uri content://host.exp.exponent.SharingFileProvider/expo_external_files/Download/IMG_2704.PNG from pid=16627, uid=1000 requires the provider be exported, or grantUriPermission() at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820) at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684) at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:674) at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:548) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:327) at android.os.Binder.execTransactInternal(Binder.java:1154) at android.os.Binder.execTransact(Binder.java:1123) ``` However, photos were sharing correctly, but I managed to fix it. I [followed the docs](https://developer.android.com/reference/androidx/core/content/FileProvider#Permissions) and updated `Intent` creation in `SharingModule.createSharingIntent()` by replacing `putExtra()` with `setData()` which resolved exception above. # Test Plan I only tested my changes using demo code from issue on API 29 & 30. Sources I used: - [Android `FileProvider `docs](https://developer.android.com/reference/androidx/core/content/FileProvider) - [Android `Intent` docs](https://developer.android.com/reference/android/content/Intent.html) - [This article](https://medium.com/@quiro91/sharing-files-through-intents-part-2-fixing-the-permissions-before-lollipop-ceb9bb0eec3a), however it made me a bit confused about `Intent.FLAG_GRANT_READ_URI_PERMISSION` flag
show more ...
[image-picker][sharing] Fix provider paths problem (#4717)
[expo-sharing] Add expo-sharing module with basic functionality (#3556)## Why Package was response for users request about possibility to share to other platforms, especially instagram https://
[expo-sharing] Add expo-sharing module with basic functionality (#3556)## Why Package was response for users request about possibility to share to other platforms, especially instagram https://expo.canny.io/feature-requests/p/make-it-possible-to-share-an-image-to-instagram-on-ios-and-android ## How Created new `expo-sharing` package with basic sharing functionality. On Android used Intent `Intent.ACTION_SEND` and to ensure file is accessible for third applications used `FileProvider`. On iOS used `UIDocumentInteractionController presentOpenInMenuFromRect` to open action sheet. For android added `mimeType` property, for iOS added `UTI` to be able to control shown applications that can handle file. ## Test Plan Test using NCL Sharing module.