how to post a picture to user group using facebook4j api using facebook groupid

1.1k views Asked by At

How to post a picture to user group using facebook4j api using facebook groupid.

PostUpdate post = new PostUpdate(new URL("projectUrl")).picture(new URL("projectUrl/waz24.jpg")).name("Facebook4J - A Java library for the Facebook Graph API");

facebook.postGroupFeed(getId, post);

above code not showing image it shows some symbol.

1

There are 1 answers

0
Java Man On

Use this for sharing photo with link and description.

PrivacyParameter privacy = new PrivacyBuilder().setValue(PrivacyType.ALL_FRIENDS).build();
PostUpdate postUpdate = new PostUpdate(new URL("http://facebook4j.org"))
    .picture(new URL("http://facebook4j.org/images/hero.png"))
    .name("Facebook4J - A Java library for the Facebook Graph API")
    .caption("facebook4j.org")
    .description("Facebook4J is a Java library for the Facebook Graph API. This library provides the ease of use like Twitter4J. Facebook4J is an unofficial library.")
    .privacy(privacy);
String postId = facebook.postFeed(postUpdate);

Thanks..