【问题标题】:Share TEXT to Google+?将文本分享到 Google+?
【发布时间】:2012-07-06 02:45:03
【问题描述】:

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

谢谢,

马修

【问题讨论】:

标签: share google-plus


【解决方案1】:

Share API 用于共享页面,尽管您可以共享一个页面并让该页面上的 Snippet 数据包含您要共享的文本。

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

【讨论】:

    【解决方案2】:

    您可以发布这样的消息.. 您的手机中是否安装了 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;
        }
    }
        });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 1970-01-01
      • 1970-01-01
      • 2013-07-15
      • 2016-07-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多