简体   繁体   中英

Open facebook specific post form android app

i am trying to open facebook specific post from android app in facebook app currently i am doing this but the facebook app is not showing my post its giving error

public static String FACEBOOK_URL = "https://www.facebook.com/" + PAGE_ID
                + "/posts/" + post.getId;


public String getFacebookPageURL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    try {
        int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
        if (versionCode >= 3002850) { //newer versions of fb app
            return "fb://facewebmodal/f?href=" + FACEBOOK_URL;
        } else { //older versions of fb app
            return "fb://post/" + post.getId();;
        }
    } catch (PackageManager.NameNotFoundException e) {
        return FACEBOOK_URL; //normal web url
    }
}

is there some kind of facebook sdk to open posts and pages ?

please checkout this link, which is of Facebook API

https://developers.facebook.com/docs/sharing/android

also you can get particulate post from Facebook

see this link

https://developers.facebook.com/docs/graph-api/reference/v3.2/post

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