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)."
Related
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.
Bellow is the code which enables to share image only within my network on facebokk page.
private void sharePhotoToFacebook(){
Log.e("in sharemethod", "hiiiiii");
Bitmap image = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption("Give me my codez or I will ... you know, do that thing you don't like!")
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
shareDialog.show(content);}
I want to to share an image to the pages not in my facebook network.
Unfortunately you can not share !
Facebook does not allow it because for this you need access tokens of the pages and if you wanna share through app on pages for this it is needed that the page which are not your network must allow you app to do so.And you also need to get permissions first from the Facebook such as posting permission or etc :)
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).
I follow facebook's tutorial and I want to share my application screen shot so i used code on below.But it didn't also i can be log in.
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(bm)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareDialog shareDialog1 = new ShareDialog(Oyun.this);
shareDialog1.show(content);
Please visit this answer given by this guy he share photos as well as include caption with it
How to share photo with CAPTION via Android share intent on Facebook?
You need to make a simple intent to Facebook for it and you can share it. Just go through the above answer and you will find it out very easy.
I've poured through the documentation, and it appears as though it is not possible to simply share a local user generated image through the ShareDialog provided in the SDK?
Can someone confirm if this is indeed the case? If it is possible, how can I do this? I only ask because it is possible to do this through OpenGraphActionDialogBuilder via setImageAttachmentsForAction, but not ShareDialogBuilder.(ex: Posting photo from a native ShareDialog in Facebook android SDK)
All I want to do is to post a status update with an image, I don't want to create link to another URL, which is required by the OpenGraphActionDialogBuilder.
It's an old question but here is my solution with the latest Facebook API:
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.scrat);
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.build();
SharePhotoContent content = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
ShareDialog dlg = new ShareDialog(MainActivity.this);
if(dlg.canShow(SharePhotoContent.class)){
dlg.show(content);
}
Don't forget you have to be logged.