Android Facebook-sdf Exception: Failed to generate preview for user

前端 未结 2 1719
春和景丽
春和景丽 2021-01-26 03:18

i\'m developing a simple android app and i want post a status in facebook using OpenGraphObject and OpenGraphAction.

if i use new FacebookDialog.ShareDialogBuilder

2条回答
  •  故里飘歌
    2021-01-26 04:09

    Have been dealing with this error for hours. Heres how I fixed it. The Actions and Objects you specified in your code are the ones that cause the problem.

    The samples provided on the Facebook developers guide aren't good enough I feel. Heres a sample code you can use that will work perfectly. Basically make sure your ObjectType -> eg: video.other is set correctly and your Action type e.g: video.watches is set right.

        void sometestCode(){
            OpenGraphObject video = OpenGraphObject.Factory.createForPost("video.other");
            video.setTitle("Awesome Video");
            video.setDescription("This video will show you how to make the Opengraph work");
    
            OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
            action.setProperty("video", video);
            action.setType("video.watches");            
    
            FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "video")
                    .build();
            uiHelper.trackPendingDialogCall(shareDialog.present());
    
        }
    

提交回复
热议问题