Java android应用程序中的Google Plus集成
我正在我的应用程序中使用Google+。我可以使用以下代码共享内容Java android应用程序中的Google Plus集成,java,android,android-intent,google-api,google-plus,Java,Android,Android Intent,Google Api,Google Plus,我正在我的应用程序中使用Google+。我可以使用以下代码共享内容 Intent shareIntent = new PlusShare.Builder(ViewGooglePlus.this) .setText("Android Testing for Google+") .setType("text/plain") .setContentUrl(
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);
但它只有在设备上安装了官方的Google+客户端时才起作用
我想分享的内容,无论官方谷歌+客户端是否安装在设备
我发现使用图书馆是可能的,但不知道如何使用它
可能吗?有人有主意吗?如果是,怎么做?如果应用程序未安装在设备中,您无法与Google+共享。您可以使用Google App Engine和
Google+API
共享内容
https://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
可以找到这样一个例子
我认为你应该选择Google Plus的OAuth认证。这将提供显式身份验证,然后基于意图 在这个机制中,您正在创建一个
WebView
并打开谷歌登录页面的链接。当用户成功登录时,google返回一个令牌,您可以在应用程序中使用它来处理不同的应用程序,如地图、位置、google+等
这里是有链接的
您需要在谷歌控制台上注册自己,并输入两个重要信息clientId和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")
使用谷歌应用程序引擎和api有可能吗?还是必须在设备上安装Google+?在这种情况下不需要Google+,但您需要在应用程序中添加Google+API。你可以查看我共享的github页面。我在API控制台中找到了client_id,但在哪里可以找到client_secret?github上的示例很旧,你可以通过检查进行身份验证并获取访问令牌。我发布github示例的原因是让你知道如何使用Google API。
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")