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