我集成了谷歌+1API在我的安卓应用程序+1推荐& sharing.When我分享我的应用程序使用安卓手机安装按钮不显示在google+帐户.Where用户可以直接download.But当我分享使用网页浏览器它显示安装按钮。
请建议我如何可能显示直接安装按钮时,用户共享我的应用程序。
发布于 2013-01-02 15:12:04
有了安卓的Google+平台,你现在可以在安卓应用程序中集成一个原生的+1按钮。
1)您首先需要在您的Activity中intialize +1 button PlusClient对象。
2)在布局中包含PlusOneButton:
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
plus:size="standard"
plus:annotation="inline" />
3)将PlusOneButton赋给Activity.onCreate处理程序中的成员变量。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPlusClient = new PlusClient(this, this, this, Scopes.PLUS_PROFILE);
mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
}
4)每次活动在Activity.onResume处理程序中接收到焦点时,刷新PlusOneButton的状态。
protected void onResume() {
super.onResume();
// Refresh the state of the +1 button each time the activity receives focus.
mPlusOneButton.initialize(mPlusClient, URL);
}
有关详细信息,请参阅
https://developers.google.com/+/mobile/android/#recommend_content_with_the_1_button
一旦你得到clickEvent on Google+按钮设置它的可见性->消失,并设置你的安装按钮可见性-->可见
希望它能有所帮助!!
https://stackoverflow.com/questions/14117300
复制相似问题