首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Google +帐户中未显示安装按钮

Google +帐户中未显示安装按钮
EN

Stack Overflow用户
提问于 2013-01-02 13:34:55
回答 1查看 141关注 0票数 1

我集成了谷歌+1API在我的安卓应用程序+1推荐& sharing.When我分享我的应用程序使用安卓手机安装按钮不显示在google+帐户.Where用户可以直接download.But当我分享使用网页浏览器它显示安装按钮。

请建议我如何可能显示直接安装按钮时,用户共享我的应用程序。

EN

回答 1

Stack Overflow用户

发布于 2013-01-02 15:12:04

有了安卓的Google+平台,你现在可以在安卓应用程序中集成一个原生的+1按钮。

1)您首先需要在您的Activity中intialize +1 button PlusClient对象。

2)在布局中包含PlusOneButton:

代码语言:javascript
运行
复制
<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处理程序中的成员变量。

代码语言:javascript
运行
复制
    @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的状态。

代码语言:javascript
运行
复制
 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+按钮设置它的可见性->消失,并设置你的安装按钮可见性-->可见

希望它能有所帮助!!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14117300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档