Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct Instagram Story Sharing shareInstagramStory fails to open Instagram app #109

Open
kurenov opened this issue Jun 21, 2022 · 6 comments

Comments

@kurenov
Copy link

kurenov commented Jun 21, 2022

When I try to share Instagram Story directly via SocialShare.shareInstagramStory, it doesn't work for me. No error messages. Instagram app isn't opened. It fails with following log only:

D/        ( 5309): com.example.igb_publishing_poc.MainActivity@c5fdd71
I/flutter ( 5309): error

However, it works only if I try to share via Native options (SocialShare.shareOptions) first. After I try Native options->Instagram Stories, then shareInstagramStory starts working as expected. It keeps working until emulator is restarted.

Note that sharing a Story via Native Options doesn't work as expected. Instagram app is opened with no image. When options as opened, I get following error logs:

E/DatabaseUtils( 5309): Writing exception to parcel
E/DatabaseUtils( 5309): java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.example.igb_publishing_poc.com.shekarmudaliyar.social_share/image/stickerAsset.png from pid=5577, uid=1000 requires the provider be exported, or grantUriPermission()
E/DatabaseUtils( 5309): 	at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820)
E/DatabaseUtils( 5309): 	at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684)
E/DatabaseUtils( 5309): 	at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:674)
E/DatabaseUtils( 5309): 	at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:548)
E/DatabaseUtils( 5309): 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:327)
E/DatabaseUtils( 5309): 	at android.os.Binder.execTransactInternal(Binder.java:1154)
E/DatabaseUtils( 5309): 	at android.os.Binder.execTransact(Binder.java:1123)

However, Instagram Direct & Instagram Feed sharing work well.

Emulator: Nexus 5, API 30, Android 11.0 x86

Flutter 3.0.2, Dart 2.17.3

@MrPlancton
Copy link

Same for me, calling share ig stories prints similar log you provided

D/ ( 5309): com.xxx.xxx.MainActivity@c5fdd71

@ksAvinash
Copy link

same issue for me as well with social_share: ^2.2.1

@WebMad
Copy link

WebMad commented Sep 30, 2022

same issue for me. Version of social_share is 2.2.1

@jb3rndt
Copy link

jb3rndt commented Oct 14, 2022

After trying to solve this issue for way too long, I found out that since Android 11 there are more restrictions on how other apps on the phone can be queried (https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9).

So adding this to the AndroidManifest.xml solved the issue for me:

<manifest package="com.example.your_package">
  <queries>
      <package android:name="com.instagram.android" />
  </queries>
  ...
</manifest>

@dpacchi
Copy link
Contributor

dpacchi commented Nov 3, 2022

The example is improved with all the latest Android 11 manifest tags and more features here: #116

@hasanm08
Copy link

After trying to solve this issue for way too long, I found out that since Android 11 there are more restrictions on how other apps on the phone can be queried (https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9).

So adding this to the AndroidManifest.xml solved the issue for me:

<manifest package="com.example.your_package">
  <queries>
      <package android:name="com.instagram.android" />
  </queries>
  ...
</manifest>

you should add this for await SocialShare.checkInstalledAppsForShare() too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants