之前整理的,放本地很容易丢..... 故上传。大牛勿喷

1、安装google paly service SDK (使用SDK Manager.exe)

2、在项目中导入google paly service的api,并在androidmanifest 内添加<meta-dataandroid:name="com.google.android.gms.version"           android:value="@integer/google_play_services_version" />

3、创建proguard异常(原文:To prevent ProGuard from stripping away required classes, add the following lines in the <project_directory>/proguard-project.txt file:)

在PROGUARD-project.txt加入

-keep class * extends java.util.ListResourceBundle {    protected Object[][] getContents();}-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {    publicstatic final ***NULL;}-keepnames @com.google.android.gms.common.annotation.KeepName class *-keepclassmembernames class * {    @ccom.google.android.gms.common.annotation.KeepName *;}-keepnames class *implements android.os.Parcelable {    public static final ** CREATOR;}

以上步骤就把google paly service 装完全了,接下来可以直接调用,具体调用方法如下:

这是运行一个demo(google wallet)

https://developers.google.com/commerce/wallet/instant-buy/android/quickstart#next_steps

这是api帮助文档

https://developers.google.com/commerce/wallet/instant-buy/android/reference/packages

这个就是把google wallet服务放到自己的项目中

https://developers.google.com/commerce/wallet/instant-buy/android/tutorial

步骤:

1、下载google的图片,必须要用的,这个是其中一个

<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"             android:layout_width="match_parent"             android:layout_height="48dp"             android:minWidth="200dp"             android:background="@drawable/wallet_button_background"             android:contentDescription="@string/wallet_buy_with_google_wallet"             android:src="@drawable/wallet_button_buy_with_foreground" />

这个属性非常重要一定要的android:minWidth="200dp"  google规定的,不然无法通过审核

2、初始化wallet client

@Override

Public void onCreate(BundlesavedInstanceState) {

super.onCreate(savedInstanceState);

...
     mWalletClient = new WalletClient(mActivity, environment, accountName,          WalletConstants.THEME_HOLO_LIGHT, connectionCallbackListener,
         connectionFailedListener);

...

}

@Override

public void onStart(){

super.onStart();
     mWalletClient.connect();

}

new WalletClient(

mActivity, environment, accountName,    WalletConstants.THEME_HOLO_LIGHT, connectionCallbackListener, connectionFailedListener);

参数详解:

mActivity  我的理解,这里可以填写this

Environment  这里只能填写两个值的其中一个:WalletConstants.ENVIRONMENT_PRODUCTION 、  WalletConstants.ENVIRONMENT_SANDBOX

官方建议,测试的时候填写 WalletConstants.ENVIRONMENT_SANDBOX

这是api的解释,没看懂

accountName :这里写的是google账户的邮箱

WalletConstants.THEME_HOLO_LIGHT

解释:Theme constant passed to the constructor of WalletClient to use Holo Light theme for Wallet on Android OS withSDK_INT >= HONEYCOMB.

看不懂

connectionCallbackListener: 这个是实现了 com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks这个接口的类的实例,直接new ConnectionCallbacks()就ok了

Android calls the methods of this object to notify the app when it connects and disconnects with Google Play Services.

这个是通知app什么时候链接(断开链接)google play service

connectionFailedListener:  这是实现了 com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener这个接口的类的实例,直接new 就行了

https://developers.google.com/commerce/wallet/instant-buy/android/tutorial

android 使用google钱包 步骤相关推荐

  1. Android程序签名详解、打包、发布到Google play步骤

    本文主要讲解Android应用程序签名相关的理论知识,包括:什么是签名.为什么要给应用程序签名.如何给应用程序签名等. 1.什么是签名?       如果这个问题不是放在Android开发中来问,如果 ...

  2. MUI中微信支付必须用自有的 Android程序签名详解、打包、发布到Google play步骤

    1.什么是签名?       如果这个问题不是放在Android开发中来问,如果是放在一个普通的版块,我想大家都知道签名的含义.可往往就是将一些生活中常用的术语放在计算机这种专业领域,大家就开始迷惑了 ...

  3. 新 Android程序签名详解、打包、发布到Google play步骤

    下文在载转载文章的基础,Buaaroid进行了修改和完善,故发为原创,特此说明. - - -- - - - -- - - - - -- - -- - - - - -- - - - -- - - - - ...

  4. Android以太坊钱包全部功能-基于web3j实现

    文章目录 需要用到的工具 Ganache Metamask 钱包功能的具体实现 引入依赖 创建钱包 第一种创建方式 第二种创建方式 keystore导入钱包 助记词导入钱包 私钥导入钱包 Ganach ...

  5. Android的Google官方设计指南(上)

    Android 设计规范 本文章是我公司一个大牛之前的公司同事翻译的Android的Google官方设计指导,经过我整理而成,分享给大家,欢迎转载,但是请保留出处和翻译作者.本指导内容详实.规范,无论 ...

  6. 【凯子哥带你夯实应用层】Android的Google官方设计指南(上)

    Android 设计规范 时间 2015.3.2 版本 V1.0 翻译 杨鹏 整理 赵凯强 本文章是我公司一个大牛之前的公司同事翻译的Android的Google官方设计指导,经过我整理而成,分享给大 ...

  7. Android自定义ViewGroup基本步骤

    1.自定义属性,获取自定义属性,可参考 ​ Android自定义View基本步骤 ​ 2.onMeasure() 方法,for循环测量子View,根据子View的宽高来计算自己的宽 高 3.onDra ...

  8. 操作系统:Android(Google公司开发的操作系统)

    ylbtech-操作系统:Android(Google公司开发的操作系统) Android是一种基于Linux的自由及开放源代码的操作系统.主要使用于移动设备,如智能手机和平板电脑,由Google(谷 ...

  9. android 打开谷歌导航,国内开启google位置记录功能/android版google maps 7+上,恢复位置记录功能在国内使用(需root)...

    android版google 地图在 7以后的版本上,位置记录功能在国内不能用了,提示本功能不能在中国使用. 至少对本人,"位置记录"功能是非常有用的功能,尤其是骑车出行时记录自己 ...

最新文章

  1. 【MM模块】Vendor Consignment 供应商寄售
  2. TextView 显示图像+文字的方法
  3. 【转】ABP源码分析六:依赖注入的实现
  4. 华为OJ平台——整形数组合并
  5. apache启服务命令_Linux系统重启apache服务命令详解
  6. SpringBoot 2.0 集成 JavaMail ,实现异步发送邮件
  7. linux_ls命令详解
  8. 华为与奔驰展开合作 HMS for Car登陆S级轿车
  9. openfeign远程调用不起作用解决_使用Spring Boot的spring.factories进行注入---SpringCloud Alibaba_若依微服务框架改造---工作笔记007
  10. Ruby设计模式透析之 —— 单例(Singleton)
  11. Thinking in Java Reading Note(2.一切都是对象)
  12. 详解将FTP映射至Windows
  13. Mac下的Homebrew安装与使用
  14. MVC2 扩展Models和自定义验证(学习笔记)
  15. 知识图谱概论(二):概念具象化描述
  16. MATLAB信号处理——信号与系统的分析基础(1)
  17. 51单片机c语言dac0832产生波形,基于51单片机的DAC0832波形发生器设计
  18. error: dst ref refs/heads/dev receives from more than one src.
  19. CAS单点登录(SSO)介绍及部署
  20. ----- 前端面试题 -----

热门文章

  1. python中利用opencv简单做图片比对
  2. 【JavaSE】经典项目 图书管理系统
  3. 计算机毕业设计之高校科研信息管理系统
  4. 华为运营商级路由器配置示例 | IS-IS Anycast FRR保护
  5. 纯正英语 值得背诵(296句)
  6. Por Una Cabeza(只差一步) 闻香识女人、真实的谎言、辛德勒名单中的探戈舞曲
  7. C++/PTA 2017final英文语句格式简单检查
  8. python分别统计男女人数_Python+ITchart实现微信中男女比例,城市分布统计并可视化显示...
  9. 我从Angular 2转向Vue.js, 也没有选择React
  10. python虚拟环境virtualenvwrapper workon命令在sh文件中无法生效的解决方法