Sharing on Facebook from Android using setContentUrl()

依然范特西╮ 提交于 2019-12-02 10:12:32

FadyDev, I don't know if you've already resolved your problem but this is what I do in place of deprecated codes:

// Builds the object    
   ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
            .putString("fb:app_id", my_app_ID)
            .putString("og:url", link_to_site)
            .putString("og:type", objectType)
            .putString("og:title", contentTitle)
            .putString("og:description", contentDescription)
            .putString("og:image", imageLink)
            .build();

// Builds the action
        ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                .setActionType(actionName)
                .putObject(objectName, object)
                .build();

// Create the openGraphContent
        ShareOpenGraphContent openGraphContent = new ShareOpenGraphContent.Builder()
                .setPreviewPropertyName(objectName)
                .setAction(action)
                .build();

        return openGraphContent;

Look in the facebook doc for what action you want to use and there corresponding object type and required parameters.

https://developers.facebook.com/docs/sharing/opengraph/using-actions https://developers.facebook.com/docs/reference/opengraph

Hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!