无法在facebook app android

时间:2015-08-28 13:12:57

标签: android facebook

我正在使用以下代码在Android上使用facebook app打开Facebook帖子的链接。帖子打开,右上角有一个类似的按钮(竖起大拇指图标),底部也有一个评论选项。但缺少共享选项。 这是代码:

/**
     * Intent to open the official Facebook app. If the Facebook app is not installed then the
     * default web browser will be used.
     *
     * </br></br>Example usage:</br>
     * <code>newFacebookIntent(context.getPackageManager(), "https://www.facebook.com/JRummyApps");</code>
     *
     * @param pm
     *            Instance of the {@link PackageManager}.
     * @param url
     *            The full URL to the Facebook page or profile.
     * @return An intent that will open the Facebook page/profile.
     */
    public static Intent newFacebookIntent(PackageManager pm, String url) {
        Uri uri;
        try {
            pm.getPackageInfo("com.facebook.katana", 0);
            // https://stackoverflow.com/a/24547437/1048340
            uri = Uri.parse("fb://facewebmodal/f?href=" + url);
        } catch (PackageManager.NameNotFoundException e) {
            uri = Uri.parse(url);
        }
        return new Intent(Intent.ACTION_VIEW, uri);
    }

上述代码的来源是this SO答案。 示例链接是:https://www.facebook.com/unesco/photos/a.10150253911838390.341477.51626468389/10153252513313390/?type=1

0 个答案:

没有答案