francedema
francedema

Reputation: 115

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:

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. I would that i can share without the application.Anyone can suggest me how i can do this?

Upvotes: 0

Views: 1418

Answers (1)

Ian Barber
Ian Barber

Reputation: 19960

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()

If you're just doing a basic share, that will work via Google Play Services if the user doesn't have Google+ installed:

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.

(edited, as I had forgotten this!)

Upvotes: 1

Related Questions