Android帖子状态意图

时间:2014-09-26 14:28:26

标签: android facebook android-studio facebook-sdk-4.0

我想在没有facebook sdk的情况下在facebook上发布文字。

我已经看到如何与facebook分享链接

  Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
// intent.putExtra(Intent.EXTRA_SUBJECT, "Foo bar"); // NB: has no effect!
        intent.putExtra(Intent.EXTRA_TEXT, urlToShare);

// See if official Facebook app is found
        boolean facebookAppFound = false;
        List<ResolveInfo> matches = getActivity().getPackageManager().queryIntentActivities(intent, 0);
        for (ResolveInfo info : matches) {
            if (info.activityInfo.packageName.toLowerCase().startsWith("com.facebook.katana")) {
                intent.setPackage(info.activityInfo.packageName);
                facebookAppFound = true;
                break;
            }
        }

// As fallback, launch sharer.php in a browser
        if (!facebookAppFound) {
            String sharerUrl = "https://www.facebook.com/sharer/sharer.php?u=" + urlToShare;
            intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
        }

        startActivity(intent);
    }

我想用同样的文字做同样的事情.. 我该怎么办?

1 个答案:

答案 0 :(得分:1)

我认为你不能真的这样做!我看一下以下链接,因为它说它是一个知道错误,Facebook似乎并不关心修复它。 Android and Facebook share intent