简体   繁体   中英

How to share on facebook using graph api in android

I want to share a link in my application.I didnt find any api for sharing link in graph api.

What is the difference between sharing and posting in facebook?How can I perform sharing ?

Thanks in advance

You can post to wall on facebook using this code:

Bundle parameters = new Bundle();
parameters.putString("message","YOUR_MESSAGE");
parameters.putString("link", "ANY_LINK");
String response = facebook.request("me/feed", parameters,
                    "POST");

Also to upload an image, you can use this code:

Bundle parameters = new Bundle();
parameters.putString("message","YOUR_MESSAGE");
parameters.putString("caption","ANY_CAPTION");
parameters.putByteArray("picture", "IMAGE_LINK");
String response = facebook.request("me/photos", parameters,
                    "POST");

Hope it will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM