I have this code for sharing an app on facebook but when i share it it puts right links but wrong picture of the app
Button bShare = (Button) findViewById(R.id.button7);
bShare.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.myglobaljournal.christmascarol");
startActivity(Intent.createChooser(intent, "Share with"));
You can use the Debug tool to check how facebook "sees" this url.
From the result you can see that there are no og meta tags defined and so facebook probably takes a random picture from the content.
Edit
Facebook uses the open graph meta tags to extract info which is then used to render the share stories on the facebook experience.
You can see an example in the archived version of the Open Graph protocol, the new version uses the tags there but it's too complicated to your needs.
The only question is: can you any control over the output of the google play store for your app?
My guess is that you can't, and if you look at other examples (such as instagram or opera mobile) the image also appears random.
Related
Created firebase dynamic short link will not preview correctly in facebook messenger.
It puts up the message and link as expected and shows a preview image with url.
The url included in the message is working but not the url if I click on the preview.
The url should be : https://q3zbm.app.goo.gl/8f7b
but the preview link becomes https://q3zbm.app.goo.gl/s?socialDescription=Welcome&socialImageUrl=http://andreasandersson.nu/images/awesome-photo.jpg&socialTitle=Gooo
I was able to reproduce this in a very small program
private void generate() {
DynamicLink.SocialMetaTagParameters.Builder params = new DynamicLink.SocialMetaTagParameters.Builder();
params.setImageUrl(Uri.parse("http://andreasandersson.nu/images/awesome-photo.jpg"));
params.setDescription("Welcome");
params.setTitle("Gooo");
FirebaseDynamicLinks.getInstance()
.createDynamicLink()
.setLink(Uri.parse("http://andreasandersson.nu"))
.setDynamicLinkDomain("q3zbm.app.goo.gl")
.setIosParameters(new DynamicLink.IosParameters.Builder("ios.app.example").build())
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
//.setSocialMetaTagParameters(params.build())
.buildShortDynamicLink(SHORT)
.addOnCompleteListener(new OnCompleteListener<ShortDynamicLink>() {
#Override
public void onComplete(#NonNull Task<ShortDynamicLink> task) {
if (task.isSuccessful()) {
Uri shortLink = task.getResult().getShortLink();
Uri flowchartLink = task.getResult().getPreviewLink();
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_TEXT, "check this:" + shortLink.toString());
shareIntent.setType("text/plain");
startActivity(Intent.createChooser(shareIntent, "share"));
}
}
});
}
I know that the app values are not correct but inputting correct ones gives no difference in the result.
Is this an error on the firebase dynamic link or is the problem with facebook messenger?
When doing the exact same thing from ios it is working as intended which should mean that this is a android related issue with the sharer?
Update: Thanks for contacting FIrebase support. This is an issue with Facebook that we already raised to them. As of now, we are yet to hear any updates from them, but once we do, we'll let you know.
I think that Facebook will not allow this because it would be in violation of their Fake news issue. The ability to change the image used when sharing links was removed and the Firebase meta info would allow you to circumvent this.
Update
After playing around with URL's it turns out I had a trailing "/" before "?" which was preventing the link working with Facebook. Using firebase links we can now set all meta info and provide custom thumbnails again.
I filed the similar question to Firebase support before. According to their support, it seems that it's on Facebook's side and they've filed a bug on Facebook. They also provided the bug tracker (https://business.facebook.com/direct-support/question/124595778189376/?force_full_site=0&business_id=191383518008569) but it appears I don't have necessary access to view the tracker, so I think this might also apply to you.
I have a share button. I share a message with some text and URL. It working well with whatsapp, Twitter and Gmail. But, in facebook share I'm able to share website link only. After, searching on web I have found ShareDialog class for facebook share.My question is how detect (ex: onClick() for facebook icon) when user click facebook icon on android default share dialog. Is it correct way ? or any other alternates is there?
My code :
public void shareApp() {
Intent sendIntent = new Intent();
String websiteLink = "https://www.manam.com";
String playStoreLink = "http://www.google.com";
String msg = "\nHey, found this cool & easy on-demand app.";
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, msg);
sendIntent.putExtra(Intent.EXTRA_TEXT,playStoreLink + msg);
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, ""));
}
It's Facebook policy.
When you implement sharing, your app should not pre-fill any content to be shared. This is inconsistent with Facebook Platform Policy, see Facebook Platform Policy, 2.3.
I also don't see an option to detect click on facebook icon. And even if you can show your share dialog you wont be able to prefil any data
I am using general share intent for sharing news link containing image as well with other social sharing application installed in my phone.
The general share code is:
twitter.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if (Utils.isNetworkAvailable(NewsDetailed.this)) {
// TODO Auto-generated method stub
Intent sendIntent = new Intent();
Intent i = getIntent();
sendIntent.setAction(Intent.ACTION_SEND);
String Title = i.getStringExtra("title");
String id = i.getStringExtra("id");
sendIntent.putExtra("android.intent.extra.TEXT", "http://www.mywesite.com/?p="+id);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
else{
showToast("Can't Post in Offline mode");
}
}
});
this code works fine for google plus, twitter, pintrest, umano etc etc..
If I want to share my news with Facebook it also works fine for news having images attached as well.
But if there is no image attached with the news, it picks an image without any criteria from the shared web link instead of picking the default image. However if the same link is shared with other social share apps it works fine and picks the default image.
if anybody has any idea as to how to fix this Facebook issue, please let me know. My application is published on google play store https://play.google.com/store/apps/details?id=com.Almuqeet.risingkashmir.
I am trying to share a text containing a link via facebook.
My code work perfectly with the facebook messenger application. But not via Facebook app.
In Facebook app i am getting a sharing view with an empty edittext. I Don't want to integrate facebook api and give sharing authorisation. I don't want to do that. I think it can be done only via extras and intent.
My sharing code:
private void ShareWebView(){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, mTitle);
startActivity(Intent.createChooser(intent, "Share with"));
}
You cannot. See Android and Facebook share intent
And especially this link provided in one of the comment : http://developers.facebook.com/bugs/332619626816423
Walkaround: If you do not want to implement it using android SDK
and you want to use
private void ShareWebView(){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, mTitle); // MUST contain 1 url
startActivity(Intent.createChooser(intent, "Share with"));
}
make sure that mTitle contains one LINK.
Why to do that: Although the fact that facebook doesn't work properly it grubs the first url or look like url from the mTitle and post-it as share url. It also automatically catch a subtitle and a photo from that url so the post/share is quite acceptable most of the time avoiding long code implementations!
i made news applicaion in android using RSS feed and now i want to share some news ie i want to upload links from my app to facebook, twitter etc.Is it possible?
Thanks
Try this :
findViewById(R.id.btnEnvoyer).setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
Intent sendMailIntent = new Intent(Intent.ACTION_SEND);
sendMailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.Share_Mail_Subject));
sendMailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.Share_Mail_Text));
sendMailIntent.setType("text/plain");
startActivity(Intent.createChooser(sendMailIntent, "Email / SMS / Tweet ?"));
}
}
);
works just fine in my latest app if you want to test it :
Comis Strips in Brussels
=> Hit [Menu], then [Share], then the button [Send Email / SMS / Tweet]=R.id.btnEnvoyer in my layout file to see the alternatives the user can choose from ...
Hope this helps you a bit ...
H.
Yes it is. Twitter and Facebook has api for you to do those.
Take a look at these
Twitter Java APIs also checkout the facebook developer page