React Native sharing base64 image is not working - android

I am developing on android. My react-native version is 0.42. I'm using react-native-share package for sharing screen view. The data I want to share is being converted to base64.
...
const uri = "data:image/jpeg;base64,...";
Share.open({
title: "Title",
message: "Message",
url: uri,
subject: "Mail subject"
})
...
This process was working properly on whatsapp, facebook and email before.
However, now, when I tried on whatsapp the response is 'Sharing failed. Please try again', on facebook I'm getting an empty text area without sharing options and on email I'm getting the text typed options except for the image.
Do you have any suggestion? Thank you.

I am using react-native-share but using the shareSingle option like this:
Share.shareSingle({
message:'I just added a new outfit to my album.',
url:Constants.image64, //base64 image
social: "whatsapp"
});
It works great on both the platforms. You can try it if it suffice your needs.

Related

How to share image on Flutter to other application

I tried using the https://pub.dartlang.org/packages/share plugin to share an image on my flutter app to other app like Whatsapp, Facebook and so on. But rather it sending the file name of the image(images/female/ankara/ank5.jpg) in my android project to the other application rather than the actually image.
How can make it send the actual image.
Hero(
tag: widget.imageList,
child: PhotoView(
imageProvider: AssetImage(widget.imageList),
)
);
final RenderBox box = context.findRenderObject();
Share.share(widget.imageList,
sharePositionOrigin:
box.localToGlobal(Offset.zero) &
box.size);
I excepted to send the actual image to the other app rather it in a string format.
As mentioned in the previous comment, you can follow the answer on this Stack Overflow post for sharing images from a Flutter app. As for selecting a different image, you can use storage path provider plugins like ext_storage or image_picker.

Facebook Share Dialog | Not showing correct details like name, description

I am working with Facebook Share Dialog When i call the Facebook Sharedialog it always get the data from href.
Code snippet -
this.facebook.showDialog({
method: 'share',
href: 'https://google.com',
name: 'Name',
picture: 'https://www.w3schools.com/w3css/img_forest.jpg',
description: 'Description'
});
See changelog v2.9 of the Graph API: https://developers.facebook.com/docs/graph-api/changelog/version2.9
90-Day Breaking Changes
The following fields are deprecated for edges and dialogs that allow
attaching links to posts:
caption
description
name
picture
thumbnail
This was changed to prevent users from using wrong OG Tags if they do not own the URL. Use OG Tags on the shared URL instead: https://developers.facebook.com/docs/sharing/webmasters/

Android - Firebase Dynamic Social Meta Tags Links on Google +

I have an application with dynamic links implemented. I'm making request to get short link with all socialMetaTagInfo defined (socialTitle, socialDescription, socialImageLink)
link is so far only dummy page with simple and whole request looks like this (I'm not filling more fields):
{
"dynamicLinkInfo": {
"dynamicLinkDomain": "dl_domain",
"link": "http://www.my_page.com",
"androidInfo": {
"androidPackageName": string
},
"socialMetaTagInfo": {
"socialTitle": string,
"socialDescription": string,
"socialImageLink": string
}
}
}
When I share result short link on Facebook I can see nice post with image, title and description. However when I share the link via Google + only link is visible without social fields. (Same for Slack for example).
Do I have to create my fallback page first? Or am I doing something wrong? I just want to know how to display the image, title and description in other social apps (pages).
Title,Desc,Images are the additional meta tags which is added to your Dynamic links.
Apps like Facebook, Twitter, Google+ will be identifying the meta data from your url and load it in the UI.
It may fail to load if the Image size is large or if Google+ app is not coded to handle it.

Facebook Module dialog error picture is not formatted properly

How do you include a picture in Titanium's Facebook Module dialog? In Titanium's example, the picture property in the dialog is a link of a picture from a website:
var data =
{
link : "http://www.appcelerator.com",
name : "Appcelerator Titanium Mobile",
message : "Checkout this cool open source project for creating mobile apps",
caption : "Appcelerator Titanium Mobile",
picture : "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png",
description : "You've got the ideas, now you've got the power. Titanium translates " +
"your hard won web skills into native applications..."
};
fb.dialog("feed", data, function(e)
{
if(e.success && e.result)
{
alert("Success! New Post ID: " + e.result);
}
else
{
if(e.error)
{
alert(e.error);
}
else
{
alert("User canceled dialog.");
}
}
});
But what if you want to use a picture that's local and NOT via a link of a website like this?
var data =
{
link: "http://play.google.com/",
name: "Android app's name",
picture: "file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg"
};
I get the picture property formatting error if I use the code above. See this image for visual reference: http://postimg.org/image/wjefdlalb/
I've tried using the FileSystem like this:
function getFile()
{
var imageFileToPost;
var imageFile = Ti.Filesystem.getFile("file:///data/data/com.appid/app_appdata/directory/name-of-image.jpg");
if (imageFile.exists())
{
console.log("exists");
imageFileToPost = imageFile.read();
}
return imageFileToPost;
}
var data =
{
link: "http://play.google.com/",
name: "Android app's name",
picture: getFile()
};
And the post is successful, there are no errors BUT the picture was NOT published on Facebook.
Note: I would use the graph but I need to use permissions like 'publish_actions' which means I have to to have Facebook review the app but they don't like prefill messages even when the user can edit message anyways. So is this really just a formatting issue with Facebook Module's dialog or it only takes URLs of a picture? If it's a formatting issue, can anyone tell me how to format this correctly because I really need to use the picture that's local and not from a website?
The answer is maybe a bit late, but I had the same issue recently.
It does not seem to be possible with the current version of the Facebook module to create a dialog to share local images.
Because I also needed this functionality for one of my apps, I forked the module (https://github.com/dthulke/ti.facebook) and added a method presentPhotoShareDialog which takes an image blob as argument. Unfortunately it only works if the native Facebook app is installed.
Example:
if (fb.getCanPresentShareDialog()) {
fb.presentPhotoShareDialog({
imageBlob : view.toImage()
});
}

construct predefined messages with properties to post on Facebook android

I want to post a pre-defined message on Facebook through my android application. I got everything to work except the 'properties' field. I want to post a message where it says:
More information: here
and when the user clicks on 'here', it should link to the page.
This is what I did:
Bundle params = new Bundle();
String s2 = "{'More information':{'text':'here', 'href':" + details + "}}";
params.putString("properties", s2);
where 'details' is the link to the page.
But it seems like facebook is not picking up this line. I successfully set up the caption, picture and other fields.
Any insights? Thanks!
This is by design, as far as I know, we do not support HTML in status updates. We will automatically create a link if you post a valid URL however, so I would suggest just pasting out the full link
".....More information: (www.yourURLhere.com)"
On Facebook, www.yourURLhere.com will be a clickable link.

Categories

Resources