1

我想允许我的网站(允许用户发布到网站本身,如果用户启用它,Facebook)能够将用户的帖子分享到 Google+。在阅读了我在 stackoverflow/etc 上可以找到的所有内容后,似乎官方 G+ API 不允许您将任何内容发布到用户的流中。这意味着我必须使用共享按钮/链接/等。问题是,我发现的每个共享按钮/链接都是用于共享 _url_s ......但我想共享文本(如果需要,可能还添加一个 URL)!如果已经有回答这个问题的问题,很抱歉重新发布,但它一定被隐藏在我搜索返回的 ~ 5,000 个问题之下:D

谢谢,

马修

4

2 回答 2

0

共享 API 旨在共享页面,尽管您可以共享一个页面并让该页面上的代码段数据包含您要共享的文本。

您可能还想查看目前处于开发者预览版中的History API,看看它是否能满足您的需求,或者向 Google 提供有关您可能需要进行哪些更改的反馈。

于 2012-07-06T18:56:05.900 回答
0

您可以发布这样的消息..无论您的手机中是否安装了 G+ 应用程序,都可以尝试,这对我有用

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    shareMediaButton = (Button) findViewById(R.id.share_button);
    shareMediaButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

             if(isGooglePlusInstalled())
                    {

                 PlusShare.Builder share = new PlusShare.Builder(MainActivity.this);
                    share.setText("write your message here.....!");
                    //share.addStream(selectedImage);
                    share.setType("text/plain");

                    startActivityForResult(share.getIntent(), 0);

        }else{
             Intent shareIntent = new PlusShare.Builder(MainActivity.this)
              .setType("text/plain")
              .setText("write your message here.....!")

              .getIntent();

          startActivityForResult(shareIntent, 0);
        }
        }

        public boolean isGooglePlusInstalled()
{
    try
    {
        getPackageManager().getApplicationInfo("com.google.android.apps.plus", 0 );
        return true;
    } 
    catch(PackageManager.NameNotFoundException e)
    {
        return false;
    }
}
    });
}
于 2014-06-14T07:43:29.593 回答