Share in Google+

断了今生、忘了曾经 提交于 2019-12-07 18:33:49

问题


I need share link in Google+ from Android app. In documentation I saw this code:

Button shareButton = (Button) findViewById(R.id.share_button);
shareButton.setOnClickListener(new OnClickListener() 
{
    @Override
    public void onClick(View v) 
    {
       // Launch the Google+ share dialog with attribution.
        Intent shareIntent = ShareCompat.IntentBuilder.from(ExampleActivity.this)
           .setType("text/plain")
           .setText("Welcome to the Google+ platform. https://developers.google.com/+")
           .getIntent()
           .setPackage("com.google.android.apps.plus");

        startActivity(shareIntent);
    } 
});

But it will work if on my phone is official client Google+. Can I share link in Google+ without to use official client.


回答1:


Google+ API doesn't support share. Link: https://developers.google.com/apis-explorer/#s/plus/v1/




回答2:


The Share Intent, shown in the code you've provided. uses the native Google+ application to share content to Google+. This is the only way to share content to Google+ on Android.



来源:https://stackoverflow.com/questions/11882775/share-in-google

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!