简体   繁体   English

如何在Google Plus上分享帖子?

[英]How to share post on google plus?

I would share a post on google plus without that the application is installed in the mobile phone.I have just seen this solution: 如果没有在手机中安装该应用程序,我会在google plus上分享一个帖子。我刚刚看到了以下解决方案:

Intent shareIntent=new Intent(Intent.ACTION_SEND);
                shareIntent.setType("text/plain");
                shareIntent.putExtra(Intent.EXTRA_TEXT,"your text here");
                shareIntent.putExtra(Intent.EXTRA_SUBJECT, "post title");
                startActivity(Intent.createChooser(shareIntent, "Share..."));

But this solution work if in the phone there is installed the application of google plus. 但是,如果在电话中安装了google plus应用程序,则此解决方案有效。 I would that i can share without the application.Anyone can suggest me how i can do this? 我希望没有该应用程序也可以共享。任何人都可以建议我该怎么做?

If you'd like to check, there is a function on PlusShare in Google Play Services - you can hide the share if the app isn't installed: http://developer.android.com/reference/com/google/android/gms/plus/PlusShare.Builder.html#isGooglePlusAvailable() 如果您想检查,Google Play服务中PlusShare上有一个功能-如果未安装该应用,则可以隐藏该共享: http : //developer.android.com/reference/com/google/android/ gms / plus / PlusShare.Builder.html#isGooglePlusAvailable()

If you're just doing a basic share, that will work via Google Play Services if the user doesn't have Google+ installed: 如果您只是进行基本共享,那么如果用户未安装Google+,则可以通过Google Play服务运行:

PlusShare.Builder share = new PlusShare.Builder(this);
share.setText("hello everyone!");
share.setContentUrl(Uri.parse("http://stackoverflow.com"));
share.setType("text/plain");
startActivityForResult(share.getIntent(), REQ_START_SHARE);

So as long as you should use PlusShare, you should be OK. 因此,只要您使用PlusShare,就可以了。

(edited, as I had forgotten this!) (编辑,因为我忘记了这一点!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM