samedi 18 avril 2015

Creating Open Graph Stories an share with android

i want to create an open graph stories to share image from my android application on facebook. i read the documentation but it's not very clear for me. i followed the document and i create an custom graph stories (visited a location). but i don't know how to use it. my application is about a nearbyme places. the user can select a url image to share on facebook.


i want to know should i use it like in this or there is another step to make.



ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "location")
.putString("og:title", "Paris theatre")
.putString("og:description", "This is a wonderful place.")
.build();

Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.ic_android); //just to test next it will be a url image

SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setUserGenerated(true)
.build();
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("location.visited")
.putObject("location", object)
.putPhoto("photo",photo)
.build();
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("location")
.setAction(action)
.build();

action.getPhoto("photo");
shareDialog.show(content);

Aucun commentaire:

Enregistrer un commentaire