Android Facebook Share Photo with Text as Link - android

Facebook SDK keeps on changing, and I would like to know how to upload a photo (when sharing) with separate text (not embedded).
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(newBitmap)
.setUserGenerated(true)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareDialog.show(Main.this, content);
Is there a way to put the text after the photo, or even have the share message (where the user can type) pre-filled with some text?
By the way, I'm using the this version of FB:
compile 'com.facebook.android:facebook-android-sdk:4.0.1'

Okay, I understand the down votes now. Not reading the policies (only because I never really do). It states there that:
Don't prefill captions, comments, messages, or the user message parameter of posts with content a person didn’t create, even if the person can edit or remove the content before sharing.
Source: https://developers.facebook.com/policy/

pre-fill text-with-image is no longer work
https://developers.facebook.com/docs/apps/review/prefill

Related

Sharing a link on facebook with a full sized image instead of a thumbnail

I am working with a project where the user will be able to share a product from my app to facebook. In this action, the user will edit the following data:
The quote/description of the product.
Set a place for the post.
Share an image from my app gallery.
When the user shares my product it generates a standard hashtag, and the user may select a place for check in.
Here is the image of the desired action.
Sharing product on Facebook
So i followed several tutorials on youtube and the documentation from facebook so i managed to use SharePhoto and Share Link with success. In my share button im using share link and setting the following properties :
String url_link_loja = "www.centauro.com.br";
ShareHashtag.Builder hashtag = new ShareHashtag.Builder();
hashtag.setHashtag("#Olympikus");
String url_imagem = "https://static.olympikus.com.br/produtos/tenis-olympikus-thin-2-feminino/91/D22-0304-791/D22-0304-791_zoom1.jpg?resize=1200:*";
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(url_imagem_test))
.setQuote(url_link_loja)
.setImageUrl(Uri.parse(url_imagem))
.setShareHashtag(hashtag.build())
.setPlaceId("Avenida Paulista")
.build();
shareDialog.show(linkContent);
Then, when i share with my app i get just a thumbnail of the image instead of a full sized image.
Share Dialog on Nexus xl
When i use Share Photo instead, i get the full image on the dialog window just the way i want, however it seems its not possible to add hashtag and quote on this object. I tried to fix this using open graph, so i used the book example from the documentation and tried do add image, but when i do, i get a callback error message that dos not specifies the problem( i already checked, its not the commom namespace error).
So, i need some advice on the matter, any insight will be helpful.

android facebook sdk setcaption not working

I am trying to share a photo with caption and link from my android app to facebook, my photo is uploaded to facebook but caption is not updating Here is my code
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.image);
SharePhoto sharePhoto1 = new SharePhoto.Builder()
.setBitmap(bitmap)
.setCaption("This is a Beautiful Picture")
.build();
ShareContent shareContent = new ShareMediaContent.Builder()
.addMedium(sharePhoto1)
.setPageId("132583174018394")
.build();
shareDialog.show(shareContent);
I was trying to do something similar and noticed that the setCaption() method did not work. Take a look at the android facebook sdk documentation in this link, and read the getCaption() method description:
"https://developers.facebook.com/docs/reference/android/current/class/SharePhoto/"
"Gets the user generated caption. Note that the 'caption' must come from the user, as pre-filled content is forbidden by the Platform Policies (2.3)."

Multiple Hasthag on Facebook Share Android

I manage to create an app that can share picture along with the hasthag with this facebook sdk version 4.+.
In my app I have three checkbox that each contains the option of hasthag people want to share.
With the code i currently have
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bitmap)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.setShareHashtag(new ShareHashtag.Builder()
.setHashtag(hastag1).build())
.build();
ShareDialog.show(SelfieActivity.this,content);
Can only post one hasthag. I have tried setting the hasthag as
.setHashtag(hastag1+" "+hastag2+" "+hastag3)
Only post the first one.
Anybody knows how to post multiple hasthag?
Unfortunately Facebook only allowed one hashtag

How to share image on Facebook with Caption from android?

I tried sharing an Image with Caption on Facebook with the help of Facebook API and the code as below:
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption("Caption is Important")
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
shareDialog.show(content);
It open up the ShareDialog but the caption wont appear in it the dialog
As per the facebook documentation shared CBroe:
https://developers.facebook.com/policy#control
According to its policy 2.3 it states that
Don't prefill captions, comments, messages, or the user message parameter of posts with content a person or business didn’t create, even if the person can edit or remove the content before sharing. You may use our Share Dialogs to prefill a single hashtag in a post, but don't prefill any content a person or business didn't create via the API.
So we are no longer allowed to pre-fill captions for images by using shareDialog or by using any other method.
You can add caption with the given method. But at share dialog of facebook. You have to manually type your caption.

How to set description or title to Facebook photo share with PhotoShareContent in Android

I am developing an Android app. In my app, I am integrating Facebook photo share feature. This is my first Android app with Facebook integration. I am able to share photo to user timeline now. But I am having problem with setting description to that image.
This is my Facebook share photo function
private void sharePhotoToFacebook(){
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(shareBitmap)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareApi.share(content, null);
}
When photo shared it shows like this in timeline
As you can see there is no description or title. What I want is I want to set title or description. Is there any function can do like below
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo).setCaption("Description")
.build();
How can I set title?
Write setCaption() method as below:
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(shareBitmap)
.setCaption("Description")
.build();
Note: need to use SDK vertion 4+. Means at least 4.1
compile 'com.facebook.android:facebook-android-sdk:4.+'
As per Facebook Platform Policies (2.3) you cannot set caption from your app. Read this note from documentation.
setCaption(String)
Sets the user generated caption for the photo. Note that the 'caption' must come from the user, as pre-filled content is forbidden by the Platform Policies (2.3).

Categories

Resources