跳转至

Android

本页面指导如何设置 Hive SDK Android 支付功能。

Hive 控制台配置

要使用 Hive SDK 计费,您需要首先在 Hive 控制台计费中配置 支付提供商设置,例如密钥值注册和市场链接。

Note

有关更多详细信息,请参阅 Google 市场账户注册

添加市场

您需要将相应的外部库添加到模块级别的 build.gradle 文件中。仅添加您将使用的市场(支付提供商)。

以下是将外部库添加到模块级 build.gradle 文件的示例。

dependencies {
   // IapV4, will be automatically included when adding the Market below.
   implementation "com.com2us.android.hive:hive-iapv4"

   // IapV4 Market, add only the Market you are using.

   // Amazon
   implementation "com.com2us.android.hive:hive-iapv4-market-amazon"

   // Google
   implementation "com.com2us.android.hive:hive-iapv4-market-google"

   // Huawei
   implementation "com.com2us.android.hive:hive-iapv4-market-huawei"

   // Lebi
   implementation "com.com2us.android.hive:hive-iapv4-market-lebi"

   // ONEStore
   implementation "com.com2us.android.hive:hive-iapv4-market-onestore"

   // Samsung
   implementation "com.com2us.android.hive:hive-iapv4-market-samsung"

   // Hive Store
   implementation "com.com2us.android.hive:hive-iapv4-market-hivestore"
}

按市场的附加设置

根据市场的不同,需要额外的设置。

华为支付设置

本节提供了使用华为支付的设置说明。


  1. 添加agconnect-services.json
    • 将从华为控制台下载的agconnect-services.json文件添加到项目文件夹中。
  2. 项目 - build.gradle 文件配置
    • 添加AppGallery Connect插件和Maven地址。
      buildscript {
          repositories {
              google()
              jcenter()
              // 华为HMS核心SDK。
              maven {url 'https://developer.huawei.com/repo/'}
          }
          dependencies {
              ...
              // 华为AppGallery Connect插件
              classpath 'com.huawei.agconnect:agcp:1.9.1.301'
          }
      }
      allprojects {
          repositories {
              google()
              jcenter()
              /// 华为HMS核心SDK。
              maven {url 'https://developer.huawei.com/repo/'}
          }
      }  
      
  3. 应用 - build.gradle 文件配置
    • 添加华为库和插件。
      dependencies {
          // 华为市场
          implementation "com.com2us.android.hive:hive-iapv4-market-huawei"
      }
      apply plugin: 'com.huawei.agconnect'
      

Samsung GalaxyStore 支付设置

本节提供有关配置三星GalaxyStore支付的说明。


  1. 在模块级的build.gradle文件中,为libs文件夹设置依赖。

    dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation fileTree(include: ['*.aar'], dir: 'libs')
    }
    
  2. 将外部库 samsung_iap_sdk-v6.1.aar 从 Hive SDK 发行版版本添加到模块级 libs 文件夹。

在模块级别的 build.gradle 文件中,移除 QQ、微信、华为和 Hive Lebi 库。如果这些库包含在应用构建中,应用可能会在 Galaxy Store 审核过程中被拒绝

```groovy
dependencies {
// List of libraries to exclude for Galaxy Store distribution build
implementation "com.com2us.android.hive:hive-authv4-provider-qq" 
implementation "com.com2us.android.hive:hive-authv4-provider-wechat"
implementation "com.com2us.android.hive:hive-authv4-provider-huawei"
implementation "com.com2us.android.hive:hive-iapv4-market-lebi"
}
```
  1. 删除以下库文件以进行构建。如果这些文件包含在应用构建中,应用可能会在Galaxy Store审核过程中被拒绝

    • mid-sdk-{VERSION_INFO}.jar<
    • mta-sdk-{VERSION_INFO}.jar
    • open_sdk_{VERSION_INFO}_lite.jar

一站式支付设置

在项目级别设置build.gradle中的以下内容。

allprojects {
    repositories {
        ...
        // only for OneStore
        maven { url 'https://repo.onestore.co.kr/repository/onestore-sdk-public' }
        ...
    }
}
Note

如果您使用的是 ONE Store SDK V21,您可以在 ONE Store 全球平台 上分发您的应用程序。有关更多信息,请参考 ONE Store 全球部署指南全球商店部署的测试选项设置