跳转至

配置信息

开始之前

项目配置

  1. 在你的资产目录中创建 client.txt 文件,内容如下:

{
    "app_id": "21005e7c6680a5d2e8ee2ce1512e13d1",
    "app_id_facebook": "110142746174189",
    "client_token_facebook": "c63376b5e358e35c599f6ace5817f5b2",
    "client_name": "SGDEMO",
    "client_code": "SGDEMO",
    "app_id_appsflyer": "4MDuMgiUXFLJVRYirfWar3"
}
+ 将 app_id 替换为 SohaGame 提供的 app_id
+ 将 app_id_facebook 替换为 SohaGame 提供的 app_id_facebook
+ 将 client_token_facebook 替换为 SohaGame 提供的 client_token_facebook
+ 将 client_name 替换为 SohaGame 提供的 client_name
+ 将 client_code 替换为 SohaGame 提供的 client_code
+ 将 app_id_appsflyer 替换为 "4MDuMgiUXFLJVRYirfWar3" (constant )

  1. 将 "google-services.json" 文件复制到项目中,位置如下:
    img.png
  2. Manifest.xml 文件配置
  3. <application> 标签中添加 android:name="com.soha.sdk.SohaApplication" 字段。

    <application
        android:name="com.soha.sdk.SohaApplication"
        tools:replace="android:allowBackup,android:icon,android:label">
    .......
    </application>
    

    • 在 Android Manifest.xml 中使用标签 android:exported="true" 进行注册。

    • 请添加以下权限:

      <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
      <uses-permission android:name="android.permission.FOREGROUND_SERVICE" tools:node="remove" />
      <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" tools:node="remove" />
      

    • 多 Dex 配置(适用于需要使用多 Dex 的游戏) 在 build.gradle 的 app 部分添加多 Dex 支持:
      defaultConfig {
              applicationId "vn.sohagame.demosohagame"
              minSdkVersion 28
              targetSdkVersion 34
              versionCode 1
              versionName "1.0.1"
              multiDexEnabled true
          }