jeudi 2 avril 2015

facebook android SDK unable to determine type of open graph object : book

i am upgrading my android app to the latest facebook SDk version "v4" the sdk is offering a better programing model indeed


but when trying to share a story using ether the new shareApi or the ShareDialog i am getting this error in the callback


unable to determine type of open graph object : book


this is my code



private void shareStoryUsingDialog(Activity activity, STORY_TYPE type ,String title, Bitmap bitmap, String peerID, Uri imgURL) {


ShareOpenGraphAction action ;
ShareOpenGraphContent content = null;
ShareOpenGraphObject obj ;

final SharePhoto photo;
if(bitmap == null && imgURL != null){
photo = new SharePhoto.Builder()
.setImageUrl(imgURL).build() ;
}else{
photo = new SharePhoto.Builder().setBitmap(bitmap).build();
}

switch (type) {
case WIN:
String objty = "og:type" ;
obj = new ShareOpenGraphObject.Builder()
.putString(objty, "books.book")
.putString("books:isbn", "0-553-57340-3")
.putString("og:title", "book title")
//.putPhotoArrayList("og:image", new ArrayList<SharePhoto>() {{add(photo);}})
.build();

action = new ShareOpenGraphAction.Builder()
.setActionType("books.reads")
.putObject("book", obj)
.build();

content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("book")
.setAction(action)
//.setPeopleIds(peers)
.build();

break;
}

if(content != null){
ShareDialog shareDiag = new ShareDialog(activity);
shareDiag.registerCallback(callbackManager, shareCallback);
if(ShareDialog.canShow(content.getClass()))
shareDiag.show(content);
//ShareDialog.show(activity, content);
//ShareApi.share(content, shareCallback);
}
}

Aucun commentaire:

Enregistrer un commentaire