I was just wondering if there was anyway to add a Google +1 button inside my Android app. I have seen a +1 on the Android Market so I would think there would be some way to do this.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
With the Google+ platform for Android, you are now able to integrate a native +1 button in your Android app.
1) You first need to initialize the
PlusClient
object in your Activity.2) Include the PlusOneButton in your layout:
3) Assign the PlusOneButton to a member variable in your Activity.onCreate handler.
4) Refresh the PlusOneButton's state each time the activity receives focus in your Activity.onResume handler.
For more information, see https://developers.google.com/+/mobile/android/#recommend_content_with_the_1_button
With new android studio(2.2.2 that's what i'm using) you can do it more easily. There is built in feature to create fragment with +1 button. You can use the layout or initialization code for PlusOneButton in an activity or anywhere you want. Check the following image:
Edit: Don't forget to configure your app in Google api console
To add google plus one, first you need to enable the API in developer console, then register your app with package name, then include the same in your app.
Here is the full example with detailed explanation.
http://www.feelzdroid.com/2014/09/google-plusone-1-button-in-android-application-integration-guide.html
the accepted answer is outdated....
XML :
Activity :
and even before that fallow this link :
https://developers.google.com/+/mobile/android/getting-started