2

I'm trying to make share function for my app to share image/video to facebook, instagram and etc.
So i got some plugins for that social_share_plugin 0.3.1 + 1(for facebook and instagram), and
share 0.6.5 + 4(for etc).
I use getTemporaryDirectory() for my flutter app root directory.
When I use share to use just share button, it works on facebook and instagram.
But, social_share_plugin not working with same path for parameter.
I implemented some codes to manifest.xml what social_share_plugin requires for successful working(also other codes too).
But i can't get why this not working.
This code is my sharing function for dialog.

switch(shareType) {
    case "SAVE":
        await saveWork(false); //save file to getTemporaryDirectory()
        break;
    case "SHARE":
        Share.shareFiles([widget.file_path]); //this works very well 
        break;
    case "FACEBOOK":
        var permission = await checkPermissions();
        if (permission.isGranted) {
            //this not working with same directory
            await SocialSharePlugin.shareToFeedFacebook(path: widget.file_path).catchError(
                (e) => print("[facebook error]: " + e.toString())
            );
        } else {
            Fluttertoast.showToast(msg: "permission is denied");
        }
        break;
    case "INSTAGRAM":
        var permission = await checkPermissions();
        if (permission.isGranted) {
            //this not working with same directory
            await SocialSharePlugin.shareToFeedInstagram(path: widget.file_path).catchError(
                (e) => print("[insta error]: " + e.toString())
            );
        } else {
            Fluttertoast.showToast(msg: "permission is denied");
        }
        break;
    }

The share dialog works well when I clicked instagram share.
But in instagram app, toast message shows Unable to load image and come back to my app when i clicked "feed" to share.
Share to direct and story shows Unable to share image.

Also, even facebook share button not showing dialog.
My file path is like /data/user/0/com.example.app/cache/save/1510196212_2-1609136165662.png

seung min
  • 125
  • 1
  • 12
  • Hi any updates regarding this issue. I also face this issue. I have created png file on "getTemporaryDirectory()" but with this "social_share" it is not loading. Although it is loading with "share" package. I'm using "2.0.5" version. – Vidu Feb 12 '21 at 03:23

1 Answers1

0

Can you try to this https://pub.dev/packages/social_share this plugin. I'm using this plugin and working fine for me.

social_share: ^2.0.5
Hitesh sapra
  • 248
  • 2
  • 12
  • 3
    does it not support for share image or video to feed? it seems there's only share to story. – seung min Dec 28 '20 at 07:32
  • final file = await ImagePicker().pickImage( source: ImageSource.gallery, ); SocialShare.shareOptions( file!.path, ).then((file) { print(file); }); || how to share image and pdf files ? – btm me May 10 '22 at 10:55