简体   繁体   中英

Google Plus Integration in android app

I am using Google+ in my app. And I can share content using following code

Intent shareIntent = new PlusShare.Builder(ViewGooglePlus.this)
                    .setText("Android Testing for Google+")
                    .setType("text/plain")
                    .setContentUrl(
                            Uri.parse("http://androidsolution4u.blogspot.in/"))
                    .getIntent()
                    .setPackage("com.google.android.apps.plus");
            startActivityForResult(shareIntent, 0);

but it works only when official Google+ client is installed on device.

I want to share content whether official Google+ client is installed in device or not.

I found here that it is possible using this library but don't know how to use it ?

Is it possible? Anybody have an idea? If yes, how can it be done?

You cant share to Google+ if the application is not installed in the device. You can use Google App Engine and Google+ APIs to share the content.

https://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API

One such example can be found here on Git .

https://github.com/imellon/Google-Plus-Android-Sample

I think you should go for OAuth Authentication of Google Plus. This will provide explicit Authentication then Intent based.

In this mechanism, you are creating one WebView and open link of Google login page. When user is login successful, google return an Token, which you can use in your application to work with its different application like Maps, Location, Google+ etc.

Here is link which have demo application .

You need to register yourself with Google Console and put two important information clientId and clientSecrets.

GOOGLE_PLUS("client id","client secret","https://accounts.google.com/o/oauth2/token","https://accounts.google.com/o/oauth2/auth",BearerToken.authorizationHeaderAccessMethod(),PlusScopes.PLUS_ME,"http://localhost","plus","https://www.googleapis.com/plus/v1/people/me/activities/public")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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