Android Integration Guide

Everything you need to bring VNGGames to your game: sign-in, in-app purchase, analytics, ads, and player engagement: in one complete reference. Every method spells out its inputs and outputs field by field, and each one is directly linkable so you can jump straight to the call you need.

打造遊戲接入 VNGGames 所需的一切: 登入、應用程式內購買、分析、廣告與玩家互動: 全部整合於一份完整參考中。每個方法都逐一欄位說明其輸入與輸出,且每個方法都可直接連結,讓你能快速跳到所需的呼叫。

打造游戏接入 VNGGames 所需的一切: 登录、应用内购买、分析、广告与玩家互动: 全部整合于一份完整参考中。每个方法都逐一字段说明其输入与输出,且每个方法都可直接链接,让你能快速跳到所需的调用。

Get started

Prerequisites

  • VNGGames SDK package: obtain the latest VNGGames SDK zip file.
  • Supported platform: Android (API 23+).
  • Minimum Java support: Java 17+.
  • Gradle: Android Gradle Plugin 8.5.1+ (Target API 36).
  • Configuration files: pass-services.json and google-services.json, obtained either from the demo project repository or by requesting them through the OP Tool.
  • Keystore: required for app signing. Obtain it via the OP Tool.
  • Development environment: Android Studio with the necessary SDK tools.
  • VNGGames SDK 套件: 取得最新的 VNGGames SDK zip 檔案。
  • 支援的平台: Android(API 23+)。
  • 最低 Java 支援: Java 17+。
  • Gradle: Android Gradle Plugin 8.5.1+(Target API 36)。
  • 設定檔: pass-services.jsongoogle-services.json,可從 demo 專案儲存庫取得,或透過 OP Tool 申請。
  • Keystore: App 簽署所需。透過 OP Tool 取得。
  • 開發環境: 安裝了必要 SDK 工具的 Android Studio。
  • VNGGames SDK 包: 获取最新的 VNGGames SDK zip 文件。
  • 支持的平台: Android(API 23+)。
  • 最低 Java 支持: Java 17+。
  • Gradle: Android Gradle Plugin 8.5.1+(Target API 36)。
  • 配置文件: pass-services.jsongoogle-services.json,可从 demo 项目仓库获取,或通过 OP Tool 申请。
  • Keystore: App 签名所需。通过 OP Tool 获取。
  • 开发环境: 安装了必要 SDK 工具的 Android Studio。

Dependencies

Every third-party library the SDK brings into your build. The vgsdk-service plugin adds them from your pass-services.json, so your build gets only the modules your game enabled. Drop your own declaration for anything listed here, or align yours to this version.

SDK 帶進你建置中的所有第三方函式庫。vgsdk-service 外掛會依你的 pass-services.json 加入它們,因此你的建置只會取得你的遊戲已啟用的模組。請移除你自己對此處列出項目的宣告,或將你的版本對齊此版本。

SDK 带进你构建中的所有第三方库。vgsdk-service 插件会依你的 pass-services.json 加入它们,因此你的构建只会取得你的游戏已启用的模块。请移除你自己对此处列出项目的声明,或将你的版本对齐此版本。

LibraryVersionGroup
com.squareup.retrofit2:retrofit2.9.0Core
androidx.security:security-crypto1.0.0Core
com.squareup.retrofit2:converter-gson2.9.0Core
com.github.bumptech.glide:glide5.0.5Core
androidx.browser:browser1.8.0Core
com.squareup.okhttp3:okhttp4.10.0Core
com.squareup.okhttp3:logging-interceptor4.10.0Core
androidx.multidex:multidex2.0.0Core
androidx.recyclerview:recyclerview1.0.0Core
androidx.appcompat:appcompat1.2.0Core
androidx.constraintlayout:constraintlayout1.1.3Core
com.google.code.gson:gson2.13.2Core
com.google.guava:guava27.0.1-androidCore
androidx.lifecycle:lifecycle-extensions2.0.0Core
androidx.lifecycle:lifecycle-compiler2.0.0Core
com.google.android.material:material1.3.0Core
androidx.databinding:viewbinding7.1.2Core
androidx.core:core-ktx1.9.0Core
androidx.activity:activity-ktx1.3.0Core
androidx.fragment:fragment-ktx1.3.0Core
org.jetbrains.kotlinx:kotlinx-coroutines-android1.5.2Core
org.jetbrains.kotlinx:kotlinx-coroutines-core1.5.2Core
org.jetbrains.kotlin:kotlin-reflect1.3.41Core
androidx.lifecycle:lifecycle-process2.4.0Core
androidx.work:work-runtime2.10.2Core
androidx.work:work-runtime-ktx2.8.1Core
io.grpc:grpc-okhttp1.32.2Core
com.google.dagger:dagger2.22.1Core
com.google.dagger:dagger-compiler2.22.1Core
com.google.firebase:firebase-crashlytics20.0.5Core
com.google.android.play:review2.0.0Core
com.google.android.play:review-ktx2.0.0Core
com.google.firebase:firebase-config23.0.1Core
com.google.android.gms:play-services-gcm17.0.0Core
androidx.datastore:datastore1.0.0Core
com.google.crypto.tink:tink-android1.13.0Core
androidx.room:room-ktx2.7.2Core
androidx.room:room-runtime2.7.2Core
androidx.room:room-compiler2.7.2Core
io.github.centrifugal:centrifuge-java0.5.0Core
androidx.viewpager2:viewpager21.1.0Core
com.facebook.android:facebook-android-sdk18.1.3Login channels
com.google.android.gms:play-services-auth20.4.0Login channels
com.android.billingclient:billing7.1.1In-App Purchase
com.appsflyer:af-android-sdk6.18.0Analytics
com.android.installreferrer:installreferrer1.0Analytics
com.google.firebase:firebase-analytics23.0.0Analytics
cn.thinkingdata.android:ThinkingAnalyticsSDK3.4.0Analytics
cn.thinkingdata.android:TDCore1.4.2Analytics
com.facebook.android:facebook-android-sdk18.1.3Social
com.unity3d.ads-mediation:mediation-sdk8.9.1In-App Ads
com.unity3d.ads-mediation:adquality-sdk7.25.1In-App Ads
com.facebook.android:audience-network-sdk6.20.0In-App Ads
com.google.firebase:firebase-messaging25.0.1Engage
com.google.firebase:firebase-inappmessaging-display22.0.3Engage
com.clevertap.android:clevertap-android-sdk7.8.0Engage
com.clevertap.android:push-templates2.1.0Engage
函式庫版本分組
com.squareup.retrofit2:retrofit2.9.0核心
androidx.security:security-crypto1.0.0核心
com.squareup.retrofit2:converter-gson2.9.0核心
com.github.bumptech.glide:glide5.0.5核心
androidx.browser:browser1.8.0核心
com.squareup.okhttp3:okhttp4.10.0核心
com.squareup.okhttp3:logging-interceptor4.10.0核心
androidx.multidex:multidex2.0.0核心
androidx.recyclerview:recyclerview1.0.0核心
androidx.appcompat:appcompat1.2.0核心
androidx.constraintlayout:constraintlayout1.1.3核心
com.google.code.gson:gson2.13.2核心
com.google.guava:guava27.0.1-android核心
androidx.lifecycle:lifecycle-extensions2.0.0核心
androidx.lifecycle:lifecycle-compiler2.0.0核心
com.google.android.material:material1.3.0核心
androidx.databinding:viewbinding7.1.2核心
androidx.core:core-ktx1.9.0核心
androidx.activity:activity-ktx1.3.0核心
androidx.fragment:fragment-ktx1.3.0核心
org.jetbrains.kotlinx:kotlinx-coroutines-android1.5.2核心
org.jetbrains.kotlinx:kotlinx-coroutines-core1.5.2核心
org.jetbrains.kotlin:kotlin-reflect1.3.41核心
androidx.lifecycle:lifecycle-process2.4.0核心
androidx.work:work-runtime2.10.2核心
androidx.work:work-runtime-ktx2.8.1核心
io.grpc:grpc-okhttp1.32.2核心
com.google.dagger:dagger2.22.1核心
com.google.dagger:dagger-compiler2.22.1核心
com.google.firebase:firebase-crashlytics20.0.5核心
com.google.android.play:review2.0.0核心
com.google.android.play:review-ktx2.0.0核心
com.google.firebase:firebase-config23.0.1核心
com.google.android.gms:play-services-gcm17.0.0核心
androidx.datastore:datastore1.0.0核心
com.google.crypto.tink:tink-android1.13.0核心
androidx.room:room-ktx2.7.2核心
androidx.room:room-runtime2.7.2核心
androidx.room:room-compiler2.7.2核心
io.github.centrifugal:centrifuge-java0.5.0核心
androidx.viewpager2:viewpager21.1.0核心
com.facebook.android:facebook-android-sdk18.1.3登入管道
com.google.android.gms:play-services-auth20.4.0登入管道
com.android.billingclient:billing7.1.1應用程式內購買
com.appsflyer:af-android-sdk6.18.0分析
com.android.installreferrer:installreferrer1.0分析
com.google.firebase:firebase-analytics23.0.0分析
cn.thinkingdata.android:ThinkingAnalyticsSDK3.4.0分析
cn.thinkingdata.android:TDCore1.4.2分析
com.facebook.android:facebook-android-sdk18.1.3社群
com.unity3d.ads-mediation:mediation-sdk8.9.1應用程式內廣告
com.unity3d.ads-mediation:adquality-sdk7.25.1應用程式內廣告
com.facebook.android:audience-network-sdk6.20.0應用程式內廣告
com.google.firebase:firebase-messaging25.0.1Engage
com.google.firebase:firebase-inappmessaging-display22.0.3Engage
com.clevertap.android:clevertap-android-sdk7.8.0Engage
com.clevertap.android:push-templates2.1.0Engage
版本分组
com.squareup.retrofit2:retrofit2.9.0核心
androidx.security:security-crypto1.0.0核心
com.squareup.retrofit2:converter-gson2.9.0核心
com.github.bumptech.glide:glide5.0.5核心
androidx.browser:browser1.8.0核心
com.squareup.okhttp3:okhttp4.10.0核心
com.squareup.okhttp3:logging-interceptor4.10.0核心
androidx.multidex:multidex2.0.0核心
androidx.recyclerview:recyclerview1.0.0核心
androidx.appcompat:appcompat1.2.0核心
androidx.constraintlayout:constraintlayout1.1.3核心
com.google.code.gson:gson2.13.2核心
com.google.guava:guava27.0.1-android核心
androidx.lifecycle:lifecycle-extensions2.0.0核心
androidx.lifecycle:lifecycle-compiler2.0.0核心
com.google.android.material:material1.3.0核心
androidx.databinding:viewbinding7.1.2核心
androidx.core:core-ktx1.9.0核心
androidx.activity:activity-ktx1.3.0核心
androidx.fragment:fragment-ktx1.3.0核心
org.jetbrains.kotlinx:kotlinx-coroutines-android1.5.2核心
org.jetbrains.kotlinx:kotlinx-coroutines-core1.5.2核心
org.jetbrains.kotlin:kotlin-reflect1.3.41核心
androidx.lifecycle:lifecycle-process2.4.0核心
androidx.work:work-runtime2.10.2核心
androidx.work:work-runtime-ktx2.8.1核心
io.grpc:grpc-okhttp1.32.2核心
com.google.dagger:dagger2.22.1核心
com.google.dagger:dagger-compiler2.22.1核心
com.google.firebase:firebase-crashlytics20.0.5核心
com.google.android.play:review2.0.0核心
com.google.android.play:review-ktx2.0.0核心
com.google.firebase:firebase-config23.0.1核心
com.google.android.gms:play-services-gcm17.0.0核心
androidx.datastore:datastore1.0.0核心
com.google.crypto.tink:tink-android1.13.0核心
androidx.room:room-ktx2.7.2核心
androidx.room:room-runtime2.7.2核心
androidx.room:room-compiler2.7.2核心
io.github.centrifugal:centrifuge-java0.5.0核心
androidx.viewpager2:viewpager21.1.0核心
com.facebook.android:facebook-android-sdk18.1.3登录渠道
com.google.android.gms:play-services-auth20.4.0登录渠道
com.android.billingclient:billing7.1.1应用内购买
com.appsflyer:af-android-sdk6.18.0分析
com.android.installreferrer:installreferrer1.0分析
com.google.firebase:firebase-analytics23.0.0分析
cn.thinkingdata.android:ThinkingAnalyticsSDK3.4.0分析
cn.thinkingdata.android:TDCore1.4.2分析
com.facebook.android:facebook-android-sdk18.1.3社交
com.unity3d.ads-mediation:mediation-sdk8.9.1应用内广告
com.unity3d.ads-mediation:adquality-sdk7.25.1应用内广告
com.facebook.android:audience-network-sdk6.20.0应用内广告
com.google.firebase:firebase-messaging25.0.1Engage
com.google.firebase:firebase-inappmessaging-display22.0.3Engage
com.clevertap.android:clevertap-android-sdk7.8.0Engage
com.clevertap.android:push-templates2.1.0Engage

Installation

Add configuration files

  • Extract the VNGGames SDK zip file.
  • From [Demo Project]/[app module]/, copy pass-services.json to [Game Project]/[app module]/.
  • From [Demo Project]/app/, copy google-services.json to the app-level module root directory.
  • Ensure these files are placed in the correct directory and do not modify them.
  • 解壓 VNGGames SDK zip 檔案。
  • [Demo Project]/[app module]/pass-services.json 複製到 [Game Project]/[app module]/
  • [Demo Project]/app/google-services.json 複製到 app 層級模組的根目錄。
  • 確保這些檔案放在正確的目錄中,且不要修改它們。
  • 解压 VNGGames SDK zip 文件。
  • [Demo Project]/[app module]/pass-services.json 复制到 [Game Project]/[app module]/
  • [Demo Project]/app/google-services.json 复制到 app 层级模块的根目录。
  • 确保这些文件放在正确的目录中,且不要修改它们。

Update build.gradle

  • In the project-level build.gradle ([Game Project]/build.gradle), add:
  • 在專案層級的 build.gradle[Game Project]/build.gradle)中加入:
  • 在项目层级的 build.gradle[Game Project]/build.gradle)中添加:
buildscript {
    repositories {
        google()
        jcenter()
        maven { url = 'https://nexus-repo.sdk.vnggames.net/repository/maven-public/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.5.1'
        classpath 'com.google.gms:google-services:4.3.15'
        classpath 'vnggames:vgsdk-service:+'
    }
}
  • In the app-level build.gradle ([Game Project]/[app module]/build.gradle), add:
  • 在 app 層級的 build.gradle[Game Project]/[app module]/build.gradle)中加入:
  • 在 app 层级的 build.gradle[Game Project]/[app module]/build.gradle)中添加:
apply plugin: 'com.android.application'
apply plugin: 'vnggames.vgsdk-service'
android {
    compileSdk 36
    defaultConfig {
        targetSdkVersion 36
    }
}
apply plugin: 'com.google.gms.google-services'
  • Sync the project with Gradle (click Sync Now in Android Studio).

  • Clean and rebuild the project: Build → Clean Project, then Build → Rebuild Project.

  • 使用 Gradle 同步專案(在 Android Studio 中點擊 Sync Now)。

  • 清理並重新建置專案:Build → Clean Project,然後 Build → Rebuild Project

  • 使用 Gradle 同步项目(在 Android Studio 中点击 Sync Now)。

  • 清理并重新构建项目:Build → Clean Project,然后 Build → Rebuild Project

Set up the keystore file

  • Copy the keystore files from [Demo Project]/keystore to [Game Project]/keystore.

  • In the app-level build.gradle, add the signing configuration:

  • 將 keystore 檔案從 [Demo Project]/keystore 複製到 [Game Project]/keystore

  • 在 app 層級的 build.gradle 中加入簽署設定:

  • 将 keystore 文件从 [Demo Project]/keystore 复制到 [Game Project]/keystore

  • 在 app 层级的 build.gradle 中添加签名配置:

android {
    signingConfigs {
        release {
            storeFile file("../keystore/tronghv.keystore")
            storePassword 'storePassword_goes_here'
            keyAlias 'tronghv'
            keyPassword 'keyPassword_goes_here'
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

Obtain the password through the OP Tool or by contacting the Store team.

透過 OP Tool 取得密碼,或聯絡 Store 團隊。

通过 OP Tool 获取密码,或联系 Store 团队。

  • Sync your project to apply the changes.
  • 同步你的專案以套用變更。
  • 同步你的项目以应用更改。

Authentication

Sign the player in through the SDK’s channel picker or a specific channel, and delete the signed-in account. Every login callback delivers the signed-in player’s info on success, or an error on cancel/failure. Zero-interaction quick login and VGA account management live in the Quick Authentication section.

透過 SDK 的頻道選擇器或指定頻道讓玩家登入,並可刪除已登入的帳號。每次登入回呼在成功時會傳回已登入玩家的資訊,在取消或失敗時則傳回錯誤。零互動的快速登入與 VGA 帳號管理位於 Quick Authentication 區段。

通过 SDK 的渠道选择器或指定渠道让玩家登录,并可删除已登录的账号。每次登录回调在成功时会返回已登录玩家的信息,在取消或失败时则返回错误。零交互的快速登录与 VGA 账号管理位于 Quick Authentication 部分。

Show the login form

Presents the login form so the player can pick a sign-in channel.

顯示登入表單,讓玩家選擇登入頻道。

显示登录表单,让玩家选择登录渠道。

PASS.showLogin(new LoginListener() {
    @Override
    public void onSuccess(UserInfo userInfo) {
        // Signed in: userInfo.userId, userInfo.displayName, userInfo.sessionId
    }
 
    @Override
    public void onFail(Error error) {
        // Handle cancel/failure
    }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA / Passport-legacy login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時存在: 請參閱 VGA / Passport-legacy 登入錯誤碼。
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时存在: 请参阅 VGA / Passport-legacy 登录错误码。

Auto login

Silently re-authenticates the last-used channel if a session exists, otherwise presents the login form.

若已存在工作階段,會以最近使用的頻道靜默重新驗證。否則顯示登入表單。

若已存在会话,会以最近使用的渠道静默重新验证。否则显示登录表单。

PASS.autoLogin(new LoginListener() {
    @Override
    public void onSuccess(UserInfo userInfo) {
        // Same result as showLogin
    }
 
    @Override
    public void onFail(Error error) { }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA / Passport-legacy login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時存在: 請參閱 VGA / Passport-legacy 登入錯誤碼。
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时存在: 请参阅 VGA / Passport-legacy 登录错误码。

Direct login to a channel

Signs in to one channel directly, bypassing the picker.

直接登入單一頻道,略過選擇器。

直接登录单一渠道,跳过选择器。

PASS.directLogin(SocialType.GOOGLE, new LoginListener() {
    @Override
    public void onSuccess(UserInfo userInfo) { /* signed in */ }
 
    @Override
    public void onFail(Error error) { /* handle failure */ }
});

Input

輸入

输入

FieldTypeDescription
socialTypeSocialTypeLogin channel to sign in to: see SocialType.
欄位型別說明
socialTypeSocialType要登入的登入頻道: 請參閱 SocialType
字段类型描述
socialTypeSocialType要登录的登录渠道: 请参阅 SocialType

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA / Passport-legacy login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時存在: 請參閱 VGA / Passport-legacy 登入錯誤碼。
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时存在: 请参阅 VGA / Passport-legacy 登录错误码。

Log out

Signs the current player out and clears the stored session.

將目前的玩家登出並清除已儲存的工作階段。

将当前玩家登出并清除已保存的会话。

PASS.logout();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Check the login session (server-side only)

Validates a player’s session from YOUR game server, not from the client. After a login callback hands the game a userID and a sessionID, the game’s backend POSTs them to /api/login/checkSession as application/x-www-form-urlencoded, and trusts the player only when returnCode is 1. There is no SDK call for this and no client-side equivalent: a client can claim any session, which is the reason the check exists. The domain to send it to and your game’s secret key are issued on request, see below.

你的遊戲伺服器驗證玩家的工作階段,而不是從用戶端。登入回呼把 userIDsessionID 交給遊戲之後,遊戲的後端以 application/x-www-form-urlencoded 將兩者 POST 到 /api/login/checkSession,只有在 returnCode1 時才信任該玩家。SDK 沒有對應的呼叫,用戶端也沒有等價做法:用戶端可以宣稱任何工作階段,這正是需要這道檢查的原因。要送往的網域與你的遊戲 secret key 需另行申請,見下方說明。

你的游戏服务器验证玩家的会话,而不是从客户端。登录回调把 userIDsessionID 交给游戏之后,游戏的后端以 application/x-www-form-urlencoded 将两者 POST 到 /api/login/checkSession,只有在 returnCode1 时才信任该玩家。SDK 没有对应的调用,客户端也没有等价做法:客户端可以声称任何会话,这正是需要这道检查的原因。要发往的域名与你的游戏 secret key 需另行申请,见下方说明。

# Domain and secret key come from your server's environment, never from a literal.
TIMESTAMP=$(date +%s)
SIG=$(printf '%s%s%s%s%s' "$VGA_SECRET_KEY" "$GAME_ID" "$USER_ID" "$TIMESTAMP" "$SESSION_ID" | md5sum | cut -d' ' -f1)
 
curl -X POST "$VGA_DOMAIN/api/login/checkSession" \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode "gameID=$GAME_ID" \
  --data-urlencode "userID=$USER_ID" \
  --data-urlencode "sessionID=$SESSION_ID" \
  --data-urlencode "timestamp=$TIMESTAMP" \
  --data-urlencode "sig=$SIG"

Server-side only. The path is /api/login/checkSession, but the DOMAIN and your game’s secret key are not published here. Email pin.sdk.dev@vng.com.vn to be issued both. The secret key must never ship in a game client.

僅限伺服器端。 路徑為 /api/login/checkSession,但網域與你的遊戲 secret key 不會公開在這裡,請來信 pin.sdk.dev@vng.com.vn 索取。secret key 絕對不可以隨遊戲用戶端一起發布。

仅限服务器端。 路径为 /api/login/checkSession,但域名与你的游戏 secret key 不会公开在这里,请来信 pin.sdk.dev@vng.com.vn 索取。secret key 绝对不可以随游戏客户端一起发布。

Input

輸入

输入

FieldTypeDescription
userIDstringUnique VNGGames user id.
sessionIDstringSession token used to authenticate backend calls.
gameIDstringA VNGGames Account credential the SDK reads.
timestampstringUnix time in SECONDS at the moment of the call.
sigstringChecksum over the other parameters: md5(secretKey + gameID + userID + timestamp + sessionID). The secret key is issued to your team and lives server-side only, which is what keeps this call off the client.
欄位型別說明
userIDstringVNGGames 唯一使用者 ID。
sessionIDstring用於驗證後端呼叫的工作階段權杖。
gameIDstringSDK 會讀取的 VNGGames Account 憑證。
timestampstring發出呼叫當下的 Unix 時間,單位為「秒」。
sigstring其餘參數的檢查碼:md5(secretKey + gameID + userID + timestamp + sessionID)。secret key 由 SDK 團隊發給你的團隊,且只存在於伺服器端,這正是這個呼叫不能放在用戶端的原因。
字段类型描述
userIDstringVNGGames 唯一用户 ID。
sessionIDstring用于验证后端调用的会话令牌。
gameIDstringSDK 会读取的 VNGGames Account 凭据。
timestampstring发出调用当下的 Unix 时间,单位为「秒」。
sigstring其余参数的校验和:md5(secretKey + gameID + userID + timestamp + sessionID)。secret key 由 SDK 团队发给你的团队,且只存在于服务器端,这正是这个调用不能放在客户端的原因。

Output

輸出

输出

FieldTypeDescription
returnCodeintTreat anything other than 1 as not signed in.
1 the session is valid.
-1 bad sig.
-2 bad parameter.
-108 the session does not exist.
-404 unknown endpoint.
-500 service error.
messagestringHuman-readable result, for your server logs rather than for players.
datanullAlways null on this endpoint. The verdict is returnCode.
欄位型別說明
returnCodeint只要不是 1,一律視為未登入。
1 工作階段有效。
-1 sig 有誤。
-2 參數有誤。
-108 工作階段不存在。
-404 端點不存在。
-500 服務錯誤。
messagestring可讀的結果訊息,用於你的伺服器紀錄,而不是顯示給玩家。
datanull這個端點永遠回傳 null,判定結果看 returnCode
字段类型描述
returnCodeint只要不是 1,一律视为未登录。
1 会话有效。
-1 sig 有误。
-2 参数有误。
-108 会话不存在。
-404 端点不存在。
-500 服务错误。
messagestring可读的结果消息,用于你的服务器日志,而不是显示给玩家。
datanull这个端点永远返回 null,判定结果看 returnCode

Quick Authentication

Zero-interaction sign-in and VGA account management: available only with VGA login. v1 (PassSDK.shared) is the first-generation API: quick login resolves on the login callback. v2 (VGSDKQuickAuth) is the listener-based facade: the listener’s onSuccess delivers the player’s info, onError the failure reason. Manage account opens the VGA account-management screen and applies to accounts signed in with either version.

零互動登入與 VGA 帳號管理: 僅在使用 VGA 登入時可用。v1PassSDK.shared)為第一代 API:快速登入透過登入回呼回傳結果。v2VGSDKQuickAuth)為以監聽器為基礎的門面:監聽器的 onSuccess 會傳回玩家資訊,onError 則傳回失敗原因。管理帳號 會開啟 VGA 帳號管理畫面,且適用於以任一版本登入的帳號。

零交互登录与 VGA 账号管理: 仅在 VGA 登录时可用。v1PassSDK.shared)为第一代 API:快速登录在登录回调上返回结果。v2VGSDKQuickAuth)为基于监听器的门面:监听器的 onSuccess 返回玩家信息,onError 返回失败原因。管理账号 会打开 VGA 账号管理界面,且适用于以任一版本登录的账号。

v1

Quick login

Signs the player in with no form to load and no required interaction.

讓玩家登入,無需載入表單,也不需要任何互動。

无需加载表单、无需任何交互即可让玩家登录。

PASS.quickLogin(new LoginListener() {
    @Override
    public void onSuccess(UserInfo userInfo) { /* signed in */ }
 
    @Override
    public void onFail(Error error) { /* error on failure */ }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時的失敗原因: 請參閱 VGA 登入錯誤碼
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时的失败原因: 请参阅 VGA 登录错误码

v2

Sign in

Presents the quick-authentication sign-in UI so the player signs in with an available account.

顯示快速身分驗證登入介面,讓玩家使用可用的帳號登入。

展示快速身份验证登录界面,让玩家使用可用账号登录。

VGSDKQuickAuth.showLogin(new VGSDKAuthenticationListener() {
    @Override
    public void onSuccess(UserInfo userInfo) { /* signed in */ }
 
    @Override
    public void onFail(Error error) { /* failed */ }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時的失敗原因: 請參閱 VGA 登入錯誤碼
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时的失败原因: 请参阅 VGA 登录错误码

Play as guest

Signs the player in as an anonymous guest: no account selection or credentials required.

以匿名訪客身分讓玩家登入: 無需選擇帳號或提供憑證。

以匿名访客身份让玩家登录: 无需选择账号或提供凭据。

VGSDKQuickAuth.playAsGuest(new VGSDKAuthenticationListener() {
    @Override
    public void onSuccess(UserInfo userInfo) { /* signed in as guest */ }
 
    @Override
    public void onFail(Error error) { /* failed */ }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時的失敗原因: 請參閱 VGA 登入錯誤碼
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时的失败原因: 请参阅 VGA 登录错误码

Show channel selection

Presents the channel picker so the player chooses which sign-in channel to use.

顯示頻道選擇器,讓玩家選擇要使用的登入頻道。

展示渠道选择器,让玩家选择要使用的登录渠道。

VGSDKQuickAuth.showChannelSelection(new VGSDKAuthenticationListener() {
    @Override
    public void onSuccess(UserInfo userInfo) { /* signed in */ }
 
    @Override
    public void onFail(Error error) { /* failed */ }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userInfoUserInfoThe signed-in player. Fields: UserInfo.
errorError?The failure reason when the player cancels or login fails: see VGA login error codes.
欄位型別說明
userInfoUserInfo已登入的玩家。欄位詳見 UserInfo
errorError?當玩家取消或登入失敗時的失敗原因: 請參閱 VGA 登入錯誤碼
字段类型描述
userInfoUserInfo已登录的玩家。字段详见 UserInfo
errorError?当玩家取消或登录失败时的失败原因: 请参阅 VGA 登录错误码

Manage account

Open account management

Opens the VGA account-management screen and reports what the player did. Works for accounts signed in with either quick-auth version.

開啟 VGA 帳號管理畫面,並回報玩家執行的操作。

打开 VGA 账号管理界面并报告玩家所执行的操作。

PASS.manageAccount(new ManageAccountListener() {
    @Override
    public void onBoundAccountSuccess(UserInfo userInfo) { /* bound */ }
 
    @Override
    public void onSwitchAccountSuccess(UserInfo userInfo) { /* switched */ }
 
    @Override
    public void onClose() { /* closed without change */ }
});

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
onBoundAccountSuccessUserInfoThe signed-in player. Fields: UserInfo.
onSwitchAccountSuccessUserInfoThe signed-in player. Fields: UserInfo.
onClose:Closed the screen without acting.
欄位型別說明
onBoundAccountSuccessUserInfo已登入的玩家。欄位詳見 UserInfo
onSwitchAccountSuccessUserInfo已登入的玩家。欄位詳見 UserInfo
onClose:未執行任何操作即關閉畫面。
字段类型描述
onBoundAccountSuccessUserInfo已登录的玩家。字段详见 UserInfo
onSwitchAccountSuccessUserInfo已登录的玩家。字段详见 UserInfo
onClose:未执行任何操作即关闭屏幕。

In-App Purchase

Query the sellable products, then run a purchase through Google Play Billing / App Store In-App Purchase. Products and purchase status are delivered on listener closures.

查詢可販售的商品,然後透過 Google Play Billing/App Store In-App Purchase 執行購買。商品與購買狀態會透過監聽器閉包傳回。

先查询可售商品,然后通过 Google Play Billing / App Store In-App Purchase 执行购买。商品与购买状态在监听器闭包上返回。

Get products

Fetches the sellable products for a set of item ids.

為一組道具 ID 取得可販售的商品。

为一组物品 id 获取可售商品。

PASS.getProductList(Arrays.asList("item-1"), new ProductListListener() {
    @Override
    public void onFinished(List<SkuDetails> products) {
        // Render pricing, e.g. products.get(0).getPrice() (store-formatted)
    }
});

Input

輸入

输入

FieldTypeDescription
itemsList<String>List of configured item id from Store.
欄位型別說明
itemsList<String>在商店設定的商品 id 清單。
字段类型描述
itemsList<String>在商店配置的商品 id 列表。

Output

輸出

输出

FieldTypeDescription
productsList<SkuDetails>The products found. Empty when no id matched. Each entry: SkuDetails.
欄位型別說明
productsList<SkuDetails>找到的商品。沒有 id 相符時為空。每個項目:SkuDetails
字段类型描述
productsList<SkuDetails>找到的商品。没有 id 匹配时为空。每个条目:SkuDetails

Purchase

Runs a purchase and reports the outcome. Build the request with the purchase-info object: all fields required.

執行購買並回報結果。使用購買資訊物件建立請求: 所有欄位皆為必填。

执行购买并报告结果。使用购买信息对象构建请求: 所有字段均为必填。

PaymentInfo info = new PaymentInfo();
info.setUserID("user-1");
info.setItemID("item-1");
info.setServerID("server-1");
info.setRoleID("role-1");
info.setAppTransID("txn-1");
info.setAddInfo("");
PASS.pay(info, new PaymentListener() {
    @Override public void onSuccess() { /* granted */ }
    @Override public void onProcessing() { /* awaiting external confirmation */ }
    @Override public void onCancel() { /* player canceled */ }
    @Override public void onFail(String message) { /* failed */ }
});

Input

輸入

输入

FieldTypeDescription
paymentInfoPaymentInfoThe purchase request: full model: PaymentInfo. Optional clientKey / secretKey set signing keys.
欄位型別說明
paymentInfoPaymentInfo購買請求: 完整模型:PaymentInfo。選填的 clientKey / secretKey 用於設定簽章金鑰。
字段类型描述
paymentInfoPaymentInfo购买请求: 完整模型:PaymentInfo。可选的 clientKey / secretKey 用于设置签名密钥。

Output

輸出

输出

FieldTypeDescription
onSuccess:Purchase completed.
onProcessing:Processing / verifying with Billing System.
onCancel:Player canceled.
onFailString?Purchase failed. See billing / store payment error codes.
欄位型別說明
onSuccess:購買完成。
onProcessing:由帳務系統處理/驗證中。
onCancel:玩家已取消。
onFailString?購買失敗。請參閱 帳務商店 付款錯誤碼。
字段类型描述
onSuccess:购买完成。
onProcessing:由计费系统处理/验证中。
onCancel:玩家已取消。
onFailString?购买失败。请参阅 计费商店 支付错误码。

Check item reward

Reports whether the player has a reward waiting to be granted, so the game can show or hide the claim entry point.

回報玩家是否有待發放的獎勵,讓遊戲決定要顯示或隱藏領取入口。

报告玩家是否有待发放的奖励,让游戏决定要显示或隐藏领取入口。

Run this before Verify reward: it only reports availability and grants nothing by itself.

請先執行此檢查,再呼叫「驗證獎勵」。它只回報是否有獎勵,本身不會發放任何內容。

请先执行此检查,再调用“验证奖励”。它只报告是否有奖励,本身不会发放任何内容。

PASS.checkItemReward(new CheckHasRewardListener() {
    @Override
    public void onSuccess(boolean isHas) {
        // true: a reward is pending, show the claim entry point
    }
 
    @Override
    public void onError(String s) {
        // The check could not complete: keep the entry point hidden
    }
});

Input

輸入

输入

FieldTypeDescription
listenerCheckHasRewardListenerResult listener for the check.
欄位型別說明
listenerCheckHasRewardListener此次檢查的結果監聽器。
字段类型描述
listenerCheckHasRewardListener本次检查的结果监听器。

Output

輸出

输出

FieldTypeDescription
onSuccess(Boolean) -> UnitCalled with true when a reward is pending, false when there is none.
onError(String?) -> UnitThe check could not complete, with the reason. No dedicated error code is raised on this path.
欄位型別說明
onSuccess(Boolean) -> Unit有待發放的獎勵時以 true 呼叫,沒有時則為 false
onError(String?) -> Unit檢查無法完成,並附上原因。此路徑不會產生專屬的錯誤碼。
字段类型描述
onSuccess(Boolean) -> Unit有待发放的奖励时以 true 调用,没有时则为 false
onError(String?) -> Unit检查无法完成,并附上原因。此路径不会产生专属的错误码。

Verify reward

Grants the pending reward and reports whether a failure is worth retrying.

發放待領取的獎勵,並回報該次失敗是否值得重試。

发放待领取的奖励,并报告该次失败是否值得重试。

Call this only after Check item reward reports a pending reward.

請僅在「檢查道具獎勵」回報有待發放的獎勵之後才呼叫。

请仅在“检查道具奖励”报告有待发放的奖励之后才调用。

RewardInfo rewardInfo = new RewardInfo();
rewardInfo.setUserID("user-1");
rewardInfo.setServerID("server-1");
rewardInfo.setAppTransID("txn-1");
rewardInfo.setAddInfo("");
rewardInfo.setRoleID("role-1");
PASS.verifyReward(rewardInfo, new VerifyRewardListener() {
    @Override public void onFinishSuccess(String message) { /* reward granted */ }
    @Override public void onFinishFailToRetry(String message) { /* transient: retrying is safe */ }
    @Override public void onFinishFailNonRetry(String message) { /* permanent, e.g. 9011: do not retry */ }
});

Input

輸入

输入

FieldTypeDescription
rewardInfoRewardInfoThe reward claim. All five fields are required.
rewardInfo.userIDString?Buyer’s VNGGames user id.
rewardInfo.serverIDStringGame server id.
rewardInfo.roleIDStringCharacter/role id.
rewardInfo.appTransIDStringYour app-side transaction id, for reconciliation.
rewardInfo.addInfoStringExtra passthrough data. Empty string when unused.
listenerVerifyRewardListenerResult listener for the grant.
欄位型別說明
rewardInfoRewardInfo獎勵領取請求。五個欄位皆為必填。
rewardInfo.userIDString?購買者的 VNGGames 使用者 ID。
rewardInfo.serverIDString伺服器 ID。
rewardInfo.roleIDString角色 ID。
rewardInfo.appTransIDString你的應用程式端交易 ID,用於對帳。
rewardInfo.addInfoString額外的傳遞資料。未使用時請傳入空字串。
listenerVerifyRewardListener此次發放的結果監聽器。
字段类型描述
rewardInfoRewardInfo奖励领取请求。五个字段均为必填。
rewardInfo.userIDString?购买者的 VNGGames 用户 ID。
rewardInfo.serverIDString服务器 ID。
rewardInfo.roleIDString角色 ID。
rewardInfo.appTransIDString你的应用端交易 ID,用于对账。
rewardInfo.addInfoString额外的透传数据。未使用时请传入空字符串。
listenerVerifyRewardListener本次发放的结果监听器。

Output

輸出

输出

FieldTypeDescription
onFinishSuccess(String?) -> UnitThe reward was granted.
onFinishFailToRetry(String?) -> UnitThe grant failed transiently. Retrying the same request is safe.
onFinishFailNonRetry(String?) -> UnitThe grant failed permanently, for example the receipt was already used or no reward package exists (9011). Do not retry the same request.
欄位型別說明
onFinishSuccess(String?) -> Unit獎勵已發放。
onFinishFailToRetry(String?) -> Unit發放因暫時性問題失敗。以相同請求重試是安全的。
onFinishFailNonRetry(String?) -> Unit發放永久失敗,例如收據已被使用,或查無獎勵包(9011)。請勿以相同請求重試。
字段类型描述
onFinishSuccess(String?) -> Unit奖励已发放。
onFinishFailToRetry(String?) -> Unit发放因临时性问题失败。以相同请求重试是安全的。
onFinishFailNonRetry(String?) -> Unit发放永久失败,例如收据已被使用,或查无奖励包(9011)。请勿以相同请求重试。

Analytics

One facade for every analytics provider, organised by use case. Configure analytics first, then send ad-hoc custom events or the structured use-case funnels (Conversion Rate = app launch → play, Onboarding = new user → early monetization, Main & Daily Activities, Social & Communities). Providers: AppsFlyer, Firebase, Data Platform, Facebook, CleverTap, ThinkingData. Every call is fire-and-forget. Every event also carries a set of default parameters the SDK fills in automatically: see Analytics default parameters.

Notice: Every event the VNGGames SDK APIs trigger starts with the vgsdk_ prefix and follows the formula vgsdk_{prefix}_{event name}: for example, vgsdk_af_app_open. See Analytics platform prefixes.

涵蓋所有分析供應商的單一門面,依使用情境組織。請先設定分析,然後傳送臨時的自訂事件,或使用結構化的使用情境漏斗(Conversion Rate=應用程式啟動 → 遊玩、Onboarding=新使用者 → 早期營利、Main & Daily Activities、Social & Communities)。供應商:AppsFlyer、Firebase、Data Platform、Facebook、CleverTap、ThinkingData。每個呼叫都是 fire-and-forget。每個事件還會帶有一組由 SDK 自動填入的預設參數: 請參閱 分析預設參數

注意: VNGGames SDK API 觸發的每個事件都以 vgsdk_ 前綴開頭,並遵循 vgsdk_{prefix}_{event name} 公式: 例如 vgsdk_af_app_open。請參閱 分析平台前綴

面向所有分析提供方的统一门面,按使用场景组织。先配置分析,然后发送临时自定义事件或结构化的使用场景漏斗(Conversion Rate = 应用启动 → 游玩,Onboarding = 新用户 → 早期变现,Main & Daily Activities,Social & Communities)。提供方:AppsFlyer、Firebase、Data Platform、Facebook、CleverTap、ThinkingData。每次调用都是 fire-and-forget。每个事件还会携带一组由 SDK 自动填充的默认参数: 请参阅 分析默认参数

注意: VNGGames SDK API 触发的每个事件都以 vgsdk_ 前缀开头,并遵循公式 vgsdk_{prefix}_{event name}: 例如 vgsdk_af_app_open。请参阅 分析平台前缀

Setup

Configure analytics

Required analytics setup: binds the current role id and name to the analytics session so tracked events carry role context. Call once after login, before sending events.

必要的分析設定:將目前的角色 ID 與名稱綁定到分析工作階段,讓追蹤的事件帶有角色情境。請在登入後、傳送事件前呼叫一次。

必需的分析设置:将当前角色 id 和名称绑定到分析会话,使追踪的事件带有角色上下文。登录后、发送事件前调用一次。

Required setup for analytics.

分析的必要設定。

分析的必需设置。

// Bind role context once after login, before sending events
VGSDKAnalytics.miscConfigAnalytics("role-1", "Hero");

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
roleNameStringCharacter/role name.
欄位型別說明
roleIdString角色 ID。
roleNameString角色名稱。
字段类型描述
roleIdString角色 id。
roleNameString角色名称。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Integration Limitations

Rules & limits

Constraints that apply to every event you send through this facade: they aggregate the rules of the underlying providers. Review them before instrumenting:

  • Event names must begin with a letter, contain no spaces (use underscores), and be at most 100 characters. They may not begin with ", \, =, +, or -, are case-sensitive (af_purchaseaf_PURCHASE), and may include non-English characters.
  • Per event: at most 25 parameters.
  • Parameter names must be at most 40 characters.
  • Parameter values must not exceed 1000 characters (longer values may be truncated). Keep total event values under 2000 characters.
  • Revenue / price values use digits and a single decimal point only, with at most 5 digits after the point.
  • Cardinality: at most 300 unique event names per day.
  • Unique users are counted only for the first 100 events after a user installs the app.
  • Referring URLs must be URL-encoded.
  • Meta (Facebook) Ads impose additional limits on event parameters.

適用於你透過此門面傳送的每個事件的限制: 它們彙整了底層各供應商的規則。請在埋點前詳閱:

  • 事件名稱 必須以字母開頭、不得包含空格(請使用底線),且最多 100 個字元。不得以 "\=+- 開頭,區分大小寫(af_purchaseaf_PURCHASE),並可包含非英文字元。
  • 每個事件: 最多 25 個參數。
  • 參數名稱 最多 40 個字元。
  • 參數值 不得超過 1000 個字元(過長的值可能會被截斷)。請將事件的總值控制在 2000 個字元以內。
  • 收益/價格值 僅能使用數字與單一小數點,小數點後最多 5 位數。
  • 基數: 每天最多 300 個不重複的事件名稱。
  • 不重複使用者 僅在使用者安裝應用程式後的前 100 個事件內計算。
  • 來源 URL 必須經過 URL 編碼。
  • Meta(Facebook)Ads 對事件參數施加額外限制。

适用于你通过此门面发送的每个事件的约束: 它们汇总了底层各提供方的规则。在埋点前请先阅读:

  • 事件名称 必须以字母开头,不含空格(使用下划线),且最多 100 个字符。不得以 "\=+- 开头,区分大小写(af_purchaseaf_PURCHASE),并且可以包含非英文字符。
  • 每个事件: 最多 25 个参数。
  • 参数名称 最多 40 个字符。
  • 参数值 不得超过 1000 个字符(过长的值可能被截断)。请将事件的总值保持在 2000 个字符以内。
  • 收入 / 价格值 只能使用数字和单个小数点,小数点后最多 5 位。
  • 基数(Cardinality): 每天最多 300 个唯一事件名称。
  • 唯一用户 仅统计用户安装应用后的前 100 个事件。
  • 引荐 URL(Referring URLs) 必须经过 URL 编码。
  • Meta(Facebook)广告 对事件参数施加额外限制。

Custom event

Send a custom event

Sends one custom event to the providers you explicitly choose via the platforms list. The event name is sent as-is: its natural name: apart from the optional per-provider prefix you set yourself. To send to the SDK’s default provider set without naming platforms, use miscCustomEvent instead.

將一個自訂事件傳送到你透過 platforms 清單明確選擇的供應商。事件名稱會原樣傳送: 使用其自然名稱: 除了你自行設定的可選每供應商前綴之外。若要在不指定平台的情況下傳送到 SDK 的預設供應商集合,請改用 miscCustomEvent

向你通过 platforms 列表显式选择的提供方发送一个自定义事件。事件名称按原样(其自然名称)发送,仅带上你自行设置的可选的每提供方前缀。若要发送到 SDK 的默认提供方集合而不指定 platforms,请改用 miscCustomEvent

// Pick the providers to send to; "" = no per-provider prefix
VGSDKAnalyticsPlatform facebook =
    new VGSDKAnalyticsPlatform(VGSDKAnalyticsProvider.facebook, "");
HashMap<String, Object> params = new HashMap<>();
params.put("level", 5);
VGSDKAnalytics.sendCustomEvent("level_up", params, facebook);

Input

輸入

输入

FieldTypeDescription
eventNameStringEvent name.
parametersHashMap<String, Object>Event parameters.
platformsVGSDKAnalyticsPlatform...Target providers. Each entry selects a provider + event-name prefix.
platforms[].providerVGSDKAnalyticsProviderProvider to send to: see VGSDKAnalyticsProvider.
platforms[].prefixStringPrefix prepended to the event name for that provider.
欄位型別說明
eventNameString事件名稱。
parametersHashMap<String, Object>事件參數。
platformsVGSDKAnalyticsPlatform...目標供應商。每個項目會選擇一個供應商+事件名稱前綴。
platforms[].providerVGSDKAnalyticsProvider要傳送到的供應商: 請參閱 VGSDKAnalyticsProvider
platforms[].prefixString為該供應商加在事件名稱前的前綴。
字段类型描述
eventNameString事件名称。
parametersHashMap<String, Object>事件参数。
platformsVGSDKAnalyticsPlatform...目标提供方。每个条目选择一个提供方 + 事件名称前缀。
platforms[].providerVGSDKAnalyticsProvider要发送到的提供方: 请参阅 VGSDKAnalyticsProvider
platforms[].prefixString为该提供方在事件名称前添加的前缀。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Misc: custom event

Sends a custom event to the SDK’s default provider set: the no-platform-list counterpart of sendCustomEvent (you don’t pick providers). The SDK auto-prefixes the event name per provider, delivering it as vgsdk_{prefix}_{event name}: see Analytics platform prefixes.

將自訂事件傳送到 SDK 的預設供應商集合: 為 sendCustomEvent 不帶平台清單的對應版本(你不需選擇供應商)。SDK 會依各供應商自動為事件名稱加上前綴,以 vgsdk_{prefix}_{event name} 傳遞: 請參閱 分析平台前綴

向 SDK 的默认提供方集合发送一个自定义事件: 即 sendCustomEvent 的无 platforms 列表版本(你不选择提供方)。SDK 会为每个提供方自动为事件名称添加前缀,以 vgsdk_{prefix}_{event name} 形式发送: 请参阅 分析平台前缀

// Sends to the SDK's default provider set (no platforms list)
HashMap<String, Object> params = new HashMap<>();
params.put("k", "v");
VGSDKAnalytics.miscCustomEvent("my_event", params);

Input

輸入

输入

FieldTypeDescription
eventNameStringEvent name.
parametersHashMap<String, Object>Event parameters.
欄位型別說明
eventNameString事件名稱。
parametersHashMap<String, Object>事件參數。
字段类型描述
eventNameString事件名称。
parametersHashMap<String, Object>事件参数。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Conversion Rate

1. App open

Logs an app open.

記錄一次應用程式開啟。

记录一次应用打开。

VGSDKAnalytics.regAppOpen(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

2. Get configuration

Logs the configuration fetch.

記錄設定的取得。

记录配置获取。

VGSDKAnalytics.regGetConfiguration(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

3. Check configuration start

Logs the start of a configuration check.

記錄一次設定檢查的開始。

记录配置检查的开始。

VGSDKAnalytics.regCheckConfigurationStart(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

4. Check configuration end

Logs the end of a configuration check.

記錄一次設定檢查的結束。

记录配置检查的结束。

VGSDKAnalytics.regCheckConfigurationEnd(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

5. CDN download start

Logs the start of a CDN resource download.

記錄一次 CDN 資源下載的開始。

记录 CDN 资源下载的开始。

VGSDKAnalytics.regCDNDownloadStart("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

6. CDN download 25%

Logs 25% CDN download progress.

記錄 CDN 下載 25% 的進度。

记录 CDN 下载进度 25%。

VGSDKAnalytics.regCDNDownload25("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

6. CDN download 50%

Logs 50% CDN download progress.

記錄 CDN 下載 50% 的進度。

记录 CDN 下载进度 50%。

VGSDKAnalytics.regCDNDownload50("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

6. CDN download 75%

Logs 75% CDN download progress.

記錄 CDN 下載 75% 的進度。

记录 CDN 下载进度 75%。

VGSDKAnalytics.regCDNDownload75("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. CDN download finish

Logs CDN download completion.

記錄 CDN 下載完成。

记录 CDN 下载完成。

VGSDKAnalytics.regCDNDownloadFinish("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

8. Extract resource start

Logs the start of resource extraction.

記錄一次資源解壓的開始。

记录资源解压的开始。

VGSDKAnalytics.regExtractResourceStart("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

9. Extract resource end

Logs the end of resource extraction.

記錄一次資源解壓的結束。

记录资源解压的结束。

VGSDKAnalytics.regExtractResourceEnd("10MB", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
sizeStringPayload / resource size.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
sizeString負載/資源大小。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
sizeString负载 / 资源大小。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Onboarding

1. Joined server

Logs a new user joining a server.

記錄新使用者加入伺服器。

记录新用户加入服务器。

VGSDKAnalytics.nruJoinedServer("server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

2. Named role

Logs a role being named.

記錄角色被命名。

记录角色被命名。

VGSDKAnalytics.nruNamedRole("server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

3. Create role success

Logs successful role creation.

記錄角色建立成功。

记录角色创建成功。

VGSDKAnalytics.nruCreateRoleSuccess("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

4. Tutorial start

Logs the tutorial starting.

記錄教學開始。

记录教程开始。

VGSDKAnalytics.nruTutorialStart("role-1", "server-1", "0", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
progressStringProgress marker.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
progressString進度標記。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
progressString进度标记。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

5. Tutorial 25%

Logs 25% tutorial progress.

記錄教學 25% 的進度。

记录教程进度 25%。

VGSDKAnalytics.nruTutorialProgress25("role-1", "server-1", "25", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
progressStringProgress marker.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
progressString進度標記。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
progressString进度标记。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

5. Tutorial 50%

Logs 50% tutorial progress.

記錄教學 50% 的進度。

记录教程进度 50%。

VGSDKAnalytics.nruTutorialProgress50("role-1", "server-1", "50", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
progressStringProgress marker.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
progressString進度標記。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
progressString进度标记。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

5. Tutorial 75%

Logs 75% tutorial progress.

記錄教學 75% 的進度。

记录教程进度 75%。

VGSDKAnalytics.nruTutorialProgress75("role-1", "server-1", "75", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
progressStringProgress marker.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
progressString進度標記。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
progressString进度标记。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

6. Tutorial finish

Logs tutorial completion.

記錄教學完成。

记录教程完成。

VGSDKAnalytics.nruTutorialProgressFinish("role-1", "server-1", "100", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
progressStringProgress marker.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
progressString進度標記。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
progressString进度标记。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Open shop

Logs the shop being opened.

記錄商店被開啟。

记录商店被打开。

VGSDKAnalytics.iapOpenShop("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Click to buy

Logs the intent to buy an item.

記錄購買道具的意圖。

记录购买物品的意向。

VGSDKAnalytics.iapClickToBuyItem("role-1", "server-1", "item-1", "Gold",
    "22000", "VND", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemPriceString物品价格。
itemCurrencyString货币代码。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Purchased item

Logs a completed purchase.

記錄一次完成的購買。

记录一次完成的购买。

VGSDKAnalytics.iapPurchasedItem("role-1", "server-1", "item-1", "Gold Pack",
    "22000", "VND", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemPriceString物品价格。
itemCurrencyString货币代码。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. VIP level up

Logs a VIP tier increase.

記錄 VIP 等級提升。

记录 VIP 等级提升。

VGSDKAnalytics.iapVipLevelUp("role-1", "server-1", "3", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
currentVipLevelStringNew VIP level.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
currentVipLevelString新的 VIP 等級。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
currentVipLevelString新的 VIP 等级。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Buy VIP reward level

Logs the purchase of a VIP reward level.

記錄購買 VIP 獎勵等級。

记录购买 VIP 奖励等级。

VGSDKAnalytics.iapBuyVipRewardLevel("role-1", "server-1", "item-1", "VIP Pack",
    "3", "22000", "VND", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemVipLevelStringVIP level of the item.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemVipLevelString道具的 VIP 等級。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemVipLevelString物品的 VIP 等级。
itemPriceString物品价格。
itemCurrencyString货币代码。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Level up

Logs a character level-up.

記錄角色升級。

记录角色升级。

VGSDKAnalytics.mdaLevelUp("role-1", "server-1", "42", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
currentLevelStringNew level.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
currentLevelString新的等級。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
currentLevelString新的等级。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

7. Agree to terms

Logs acceptance of all terms.

記錄同意所有條款。

记录接受所有条款。

VGSDKAnalytics.nruAgreeAllTerm(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Main & Daily Activities

Main quest

Logs main-quest progress.

記錄主線任務的進度。

记录主线任务进度。

VGSDKAnalytics.mdaMainQuest("role-1", "server-1", "q1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
mainQuestIdStringMain-quest id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
mainQuestIdString主線任務 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
mainQuestIdString主线任务 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Daily quest

Logs daily-quest progress.

記錄每日任務的進度。

记录每日任务进度。

VGSDKAnalytics.mdaDailyQuest("role-1", "server-1", "d1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
dailyQuestIdStringDaily-quest id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
dailyQuestIdString每日任務 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
dailyQuestIdString每日任务 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Grant daily reward

Logs a daily reward grant.

記錄一次每日獎勵的發放。

记录发放一次每日奖励。

VGSDKAnalytics.mdaGrantDailyReward("role-1", "server-1", "r1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
dailyRewardIdStringDaily-reward id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
dailyRewardIdString每日獎勵 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
dailyRewardIdString每日奖励 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Buy item

Logs an in-game (soft-currency) item purchase.

記錄一次遊戲內(軟性貨幣)道具購買。

记录一次游戏内(软通货)物品购买。

VGSDKAnalytics.mdaBuyItem("role-1", "server-1", "item-1", "Potion",
    "100", "gold", "5", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
itemQuantityStringItem quantity.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
itemQuantityString道具數量。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemPriceString物品价格。
itemCurrencyString货币代码。
itemQuantityString物品数量。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Spend item

Logs spending/consuming an item.

記錄花費/消耗道具。

记录消耗 / 使用一个物品。

VGSDKAnalytics.mdaSpendItem("role-1", "server-1", "item-1", "Potion",
    "100", "gold", "5", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
itemQuantityStringItem quantity.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
itemQuantityString道具數量。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemPriceString物品价格。
itemCurrencyString货币代码。
itemQuantityString物品数量。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Gacha

Logs a gacha pull.

記錄一次轉蛋抽取。

记录一次抽卡。

VGSDKAnalytics.mdaGacha("role-1", "server-1", "banner-a", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
gachaTypeStringGacha type/banner.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
gachaTypeString轉蛋類型/卡池。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
gachaTypeString抽卡类型 / 卡池。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Social & Communities

Create guild

Logs a guild-creation event.

記錄一次公會建立事件。

记录一次公会创建事件。

VGSDKAnalytics.scCreateGuild("role-1", "server-1", "g1", "Guild", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
guildIdStringGuild id.
guildNameStringGuild name.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
guildIdString公會 ID。
guildNameString公會名稱。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
guildIdString公会 id。
guildNameString公会名称。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Join guild

Logs a guild-join event.

記錄一次加入公會事件。

记录一次加入公会事件。

VGSDKAnalytics.scJoinGuild("role-1", "server-1", "g1", "Guild", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
guildIdStringGuild id.
guildNameStringGuild name.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
guildIdString公會 ID。
guildNameString公會名稱。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
guildIdString公会 id。
guildNameString公会名称。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Quit guild

Logs a guild-quit event.

記錄一次退出公會事件。

记录一次退出公会事件。

VGSDKAnalytics.scQuitGuild("role-1", "server-1", "g1", "Guild", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
guildIdStringGuild id.
guildNameStringGuild name.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
guildIdString公會 ID。
guildNameString公會名稱。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
guildIdString公会 id。
guildNameString公会名称。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Add friend

Logs adding a friend on a platform.

記錄在平台上新增一位好友。

记录在某平台上添加好友。

VGSDKAnalytics.scAddFriendToList("role-1", "server-1", "facebook", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
platformStringSocial platform name.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
platformString社群平台名稱。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
platformString社交平台名称。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Remove friend

Logs removing a friend on a platform.

記錄在平台上移除一位好友。

记录在某平台上移除好友。

VGSDKAnalytics.scRemoveFriendFromList("role-1", "server-1", "facebook", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
platformStringSocial platform name.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
platformString社群平台名稱。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
platformString社交平台名称。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Share to Facebook

Logs a share-to-Facebook event.

記錄一次分享到 Facebook 的事件。

记录一次分享到 Facebook 的事件。

VGSDKAnalytics.scShareToFacebook("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Invite Facebook friend

Logs a Facebook friend-invite event.

記錄一次 Facebook 好友邀請事件。

记录一次 Facebook 好友邀请事件。

VGSDKAnalytics.scInviteFacebookFriend("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Share to Instagram

Logs a share-to-Instagram event.

記錄一次分享到 Instagram 的事件。

记录一次分享到 Instagram 的事件。

VGSDKAnalytics.scShareToInstagram("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Other

Splash screen

Logs the splash screen being shown.

記錄啟動畫面被顯示。

记录启动画面的展示。

VGSDKAnalytics.regSplashScreen(new HashMap<>());

Input

輸入

输入

FieldTypeDescription
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Purchase canceled

Logs a canceled purchase.

記錄一次已取消的購買。

记录一次已取消的购买。

VGSDKAnalytics.iapPurchasedCanceledItem("role-1", "server-1", "item-1", "Gold",
    "22000", "VND", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
itemIdStringItem id.
itemNameStringItem name.
itemPriceStringItem price.
itemCurrencyStringCurrency code.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
itemIdString道具 ID。
itemNameString道具名稱。
itemPriceString道具價格。
itemCurrencyString貨幣代碼。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
itemIdString物品 id。
itemNameString物品名称。
itemPriceString物品价格。
itemCurrencyString货币代码。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Switch account

Logs an account switch.

記錄一次帳號切換。

记录一次账号切换。

VGSDKAnalytics.miscSwitchAccount("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Customer support

Logs a customer-support entry.

記錄一次進入客戶支援。

记录一次进入客户支持。

VGSDKAnalytics.miscCustomerSupport("role-1", "server-1", new HashMap<>());

Input

輸入

输入

FieldTypeDescription
roleIdStringCharacter/role id.
serverIdStringGame server id.
extraDataHashMap<String, Object>Additional custom key/values attached to the event.
欄位型別說明
roleIdString角色 ID。
serverIdString遊戲伺服器 ID。
extraDataHashMap<String, Object>附加到事件的額外自訂鍵/值。
字段类型描述
roleIdString角色 id。
serverIdString游戏服务器 id。
extraDataHashMap<String, Object>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Ad revenue

Reports ad revenue through the unified analytics facade.

透過統一分析介面回報廣告收益。

通过统一分析接口上报广告收入。

// Reports ad revenue through the unified analytics facade
HashMap<String, String> extraData = new HashMap<>();
VGSDKAnalytics.miscAdRevenue("AdMob", VGSDKAdRevenueMediationNetwork.GoogleAdMob,
    22000.0, "VND", extraData);

Input

輸入

输入

FieldTypeDescription
monetizationNetworkStringMonetization network name.
mediationNetworkVGSDKAdRevenueMediationNetworkMediation network: see Ad revenue mediation network.
revenueDoubleRevenue amount.
currencyCodeStringCurrency code.
extraDataMap<String, String>Additional custom key/values attached to the event.
欄位型別說明
monetizationNetworkString營利聯播網名稱。
mediationNetworkVGSDKAdRevenueMediationNetwork中介聯播網: 請參閱 廣告收益中介聯播網
revenueDouble收益金額。
currencyCodeString貨幣代碼。
extraDataMap<String, String>附加到事件的額外自訂鍵/值。
字段类型描述
monetizationNetworkString变现网络名称。
mediationNetworkVGSDKAdRevenueMediationNetwork聚合网络: 请参阅 广告收入聚合网络
revenueDouble收入金额。
currencyCodeString货币代码。
extraDataMap<String, String>附加到该事件的额外自定义键值对。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Customer Support

Open the in-app support center, signed in and pre-filled with the player’s context. Results arrive on the listener’s closures.

開啟應用程式內的支援中心,已登入並預先填入玩家的情境資料。結果會透過監聽器的閉包傳回。

打开应用内客户支持中心,已登录并预填了玩家的上下文。结果在监听器的闭包上返回。

Open support center

Presents the support center for the player.

為玩家顯示支援中心。

为玩家展示客户支持中心。

VGSDKSupportInfo info = new VGSDKSupportInfo("user-1", "server-1", "10",
        "role", "vga", "guild", "Need help");
VGSDKSupport.openSupportCenter(info, new VGSDKSupportCenterListener() {
    @Override public void onAction(Map<String, Object> payload) { }
    @Override public void onClosed() { }
    @Override public void onError(VGSDKError error) { }
});

Input

輸入

输入

FieldTypeDescription
infoVGSDKSupportInfoPlayer context: full model: VGSDKSupportInfo.
欄位型別說明
infoVGSDKSupportInfo玩家情境: 完整模型:VGSDKSupportInfo
字段类型描述
infoVGSDKSupportInfo玩家上下文: 完整模型:VGSDKSupportInfo

Output

輸出

输出

FieldTypeDescription
onActionMap<String, Any>An in-portal action the player triggered, with its payload.
onClosed:The support center was dismissed.
onErrorVGSDKErrorAn error occurred: see General error codes.
欄位型別說明
onActionMap<String, Any>玩家在支援中心內觸發的操作,附帶其負載。
onClosed:支援中心已關閉。
onErrorVGSDKError發生錯誤: 請參閱 一般錯誤碼
字段类型描述
onActionMap<String, Any>玩家在门户内触发的操作及其负载。
onClosed:客户支持中心已关闭。
onErrorVGSDKError发生了错误: 请参阅 通用错误码

In-App Ads

Monetize with ironSource-mediated rewarded video, or Meta Audience Network interstitial / rewarded formats. Ad events arrive on the listener objects you pass in: there is no status enum.

透過 ironSource 中介的獎勵影片,或 Meta Audience Network 的插頁式/獎勵式格式進行營利。廣告事件會透過你傳入的監聽器物件傳回: 沒有狀態列舉。

通过 ironSource 聚合的激励视频,或 Meta Audience Network 的插屏 / 激励格式进行变现。广告事件在你传入的监听器对象上返回: 没有状态枚举。

ironSource

Initialize ironSource

Initializes ironSource with an init listener and a rewarded-video listener.

以初始化監聽器與獎勵影片監聽器初始化 ironSource。

使用一个初始化监听器和一个激励视频监听器来初始化 ironSource。

PassLevelPlayRewardedVideoListener rvListener = new PassLevelPlayRewardedVideoListener() {
    @Override
    public void adRewarded(Placement placement, AdInfo adInfo) { /* grant reward */ }
 
    @Override
    public void adShowFailed(IronSourceError error, AdInfo adInfo) { /* show failed */ }
};
 
PASS.initIronSource(rvListener, new PassInitIronSourceCallback() {
    @Override
    public void onComplete() { /* ironSource ready */ }
 
    @Override
    public void onFail() { /* init failed */ }
});

Input

輸入

输入

FieldTypeDescription
rewardedVideoListenerPassLevelPlayRewardedVideoListenerRewarded-video ad-event listener (see Show rewarded video). Ad/reward events for later shows arrive here.
initCallbackPassInitIronSourceCallbackInitialization listener: reports init success/failure.
欄位型別說明
rewardedVideoListenerPassLevelPlayRewardedVideoListener獎勵影片廣告事件監聽器(請參閱「顯示獎勵影片」)。後續顯示的廣告/獎勵事件會送達這裡。
initCallbackPassInitIronSourceCallback初始化監聽器: 回報初始化成功/失敗。
字段类型描述
rewardedVideoListenerPassLevelPlayRewardedVideoListener激励视频广告事件监听器(见“展示激励视频”)。后续展示的广告/奖励事件会送达这里。
initCallbackPassInitIronSourceCallback初始化监听器: 报告初始化成功/失败。

Output

輸出

输出

FieldTypeDescription
initCallback.onComplete() -> UnitInitialization finished: ironSource is ready.
initCallback.onFail() -> UnitInitialization failed.
adRewarded(Placement?, AdInfo?) -> UnitReward earned: grant it here.
adAvailable(AdInfo?) -> UnitAn ad is available.
adUnavailable() -> UnitNo ad available.
adOpened(AdInfo?) -> UnitAd opened.
adClicked(Placement?, AdInfo?) -> UnitAd clicked.
adClosed(AdInfo?) -> UnitAd closed.
adShowFailed(IronSourceError?, AdInfo?) -> UnitAd failed to show: carries the underlying ironSource error (its native code, not a VGSDK code).
failed() -> UnitA pre-show check failed: no error payload.
欄位型別說明
initCallback.onComplete() -> Unit初始化完成: ironSource 已就緒。
initCallback.onFail() -> Unit初始化失敗。
adRewarded(Placement?, AdInfo?) -> Unit獲得的獎勵: 在此發放。
adAvailable(AdInfo?) -> Unit有可用的廣告。
adUnavailable() -> Unit沒有可用的廣告。
adOpened(AdInfo?) -> Unit廣告已開啟。
adClicked(Placement?, AdInfo?) -> Unit廣告被點擊。
adClosed(AdInfo?) -> Unit廣告已關閉。
adShowFailed(IronSourceError?, AdInfo?) -> Unit廣告顯示失敗: 帶有底層的 ironSource 錯誤(其原生代碼,非 VGSDK 代碼)。
failed() -> Unit顯示前檢查失敗: 無錯誤負載。
字段类型描述
initCallback.onComplete() -> Unit初始化完成: ironSource 已就绪。
initCallback.onFail() -> Unit初始化失败。
adRewarded(Placement?, AdInfo?) -> Unit获得的奖励: 在此发放。
adAvailable(AdInfo?) -> Unit有可用的广告。
adUnavailable() -> Unit没有可用的广告。
adOpened(AdInfo?) -> Unit广告已打开。
adClicked(Placement?, AdInfo?) -> Unit广告被点击。
adClosed(AdInfo?) -> Unit广告已关闭。
adShowFailed(IronSourceError?, AdInfo?) -> Unit广告展示失败: 携带底层的 ironSource 错误(其原生代码,非 VGSDK 代码)。
failed() -> Unit展示前检查失败: 无错误负载。

Show rewarded video

Shows a rewarded video for a placement. Ad events arrive on the rewarded-video listener.

為某個版位顯示獎勵影片。廣告事件會透過獎勵影片監聽器傳回。

为某个广告位展示激励视频。广告事件在激励视频监听器上返回。

RewardVideo video = new RewardVideo.RewardBuilder()
    .setPlacementName("Main")
    .setTrackNetworkState(true)
    .buildReward();
PASS.showVideoAds(video);
// Ad events (incl. adRewarded) arrive on the listener passed to initIronSource

Input

輸入

输入

FieldTypeDescription
rewardVideoRewardVideoBuilt with a placement name and a network-state flag.
rewardVideo.placementNameStringPlacement to show.
rewardVideo.trackNetworkStateBooleanWhether to track network state.
欄位型別說明
rewardVideoRewardVideo以版位名稱與網路狀態旗標建構。
rewardVideo.placementNameString要顯示的版位。
rewardVideo.trackNetworkStateBoolean是否追蹤網路狀態。
字段类型描述
rewardVideoRewardVideo以广告位名称与网络状态标志构建。
rewardVideo.placementNameString要展示的广告位。
rewardVideo.trackNetworkStateBoolean是否跟踪网络状态。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Set dynamic user id

Updates the ironSource dynamic user id used for server-to-server reward callbacks.

更新用於伺服器對伺服器獎勵回呼的 ironSource 動態使用者 ID。

更新用于服务端到服务端奖励回调的 ironSource 动态用户 id。

PASS.setDynamicUserId("user-1");

Input

輸入

输入

FieldTypeDescription
userIDStringDynamic user id for verifying rewarded-ad transactions: set before showing the ad, returned in the server-to-server reward callback (1 to 64 alphanumeric characters).
欄位型別說明
userIDString用於驗證獎勵廣告交易的動態使用者 ID: 需在顯示廣告前設定。會在伺服器對伺服器獎勵回呼中回傳(1 至 64 個英數字元)。
字段类型描述
userIDString用于验证激励广告交易的动态用户 id: 需在展示广告前设置。会在服务端到服务端奖励回调中返回(1 至 64 个字母数字字符)。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Meta Audience Network

Show interstitial

Shows a Meta Audience Network interstitial.

顯示 Meta Audience Network 插頁式廣告。

展示一个 Meta Audience Network 插屏广告。

VGSDKMetaAdsInterstitialListener listener = new VGSDKMetaAdsInterstitialListener() {
    @Override
    public void adLoaded(Ad ad) { /* ready to show */ }
 
    @Override
    public void error(Ad ad, AdError adError) { /* load/show failed */ }
};
VGSDKMetaAds.showInterstitial("placement-id", listener);

Input

輸入

输入

FieldTypeDescription
placementIdStringMeta placement id.
listenerVGSDKMetaAdsInterstitialListenerAd-event listener.
欄位型別說明
placementIdStringMeta 版位 ID。
listenerVGSDKMetaAdsInterstitialListener廣告事件監聽器。
字段类型描述
placementIdStringMeta 广告位 id。
listenerVGSDKMetaAdsInterstitialListener广告事件监听器。

Output

輸出

输出

FieldTypeDescription
adLoaded(Ad?) -> UnitAd loaded.
interstitialDisplayed(Ad?) -> UnitInterstitial displayed.
interstitialDismissed(Ad?) -> UnitInterstitial dismissed.
adClicked(Ad?) -> UnitAd clicked.
loggingImpression(Ad?) -> UnitImpression logged.
error(Ad?, AdError?) -> UnitLoad/show failed: carries the native Meta AdError (not a VGSDK code).
欄位型別說明
adLoaded(Ad?) -> Unit廣告已載入。
interstitialDisplayed(Ad?) -> Unit插頁廣告已顯示。
interstitialDismissed(Ad?) -> Unit插頁廣告已關閉。
adClicked(Ad?) -> Unit廣告被點擊。
loggingImpression(Ad?) -> Unit已記錄曝光。
error(Ad?, AdError?) -> Unit載入/顯示失敗: 帶有原生 Meta AdError(非 VGSDK 代碼)。
字段类型描述
adLoaded(Ad?) -> Unit广告已加载。
interstitialDisplayed(Ad?) -> Unit插屏广告已展示。
interstitialDismissed(Ad?) -> Unit插屏广告已关闭。
adClicked(Ad?) -> Unit广告被点击。
loggingImpression(Ad?) -> Unit已记录曝光。
error(Ad?, AdError?) -> Unit加载/展示失败: 携带原生 Meta AdError(非 VGSDK 代码)。

Show rewarded video

Shows a Meta rewarded video. A complete closure fires when the reward is earned.

顯示 Meta 獎勵影片。當獲得獎勵時會觸發 complete 閉包。

展示一个 Meta 激励视频。获得奖励时触发 complete 闭包。

VGSDKMetaAdsRewardedVideoListener listener = new VGSDKMetaAdsRewardedVideoListener() {
    @Override
    public void rewardedVideoCompleted() { /* grant reward */ }
 
    @Override
    public void error(Ad ad, AdError adError) { /* load/show failed */ }
};
VGSDKMetaAds.showRewardedVideo("placement-id", "user-1", "gold", listener);

Input

輸入

输入

FieldTypeDescription
placementIdStringMeta placement id.
userIdStringPlayer id for the reward callback.
currencyStringReward currency name.
listenerVGSDKMetaAdsRewardedVideoListenerAd-event listener.
欄位型別說明
placementIdStringMeta 版位 ID。
userIdString用於獎勵回呼的玩家 ID。
currencyString獎勵貨幣名稱。
listenerVGSDKMetaAdsRewardedVideoListener廣告事件監聽器。
字段类型描述
placementIdStringMeta 广告位 id。
userIdString用于奖励回调的玩家 id。
currencyString奖励货币名称。
listenerVGSDKMetaAdsRewardedVideoListener广告事件监听器。

Output

輸出

输出

FieldTypeDescription
rewardedVideoCompleted() -> UnitReward earned: grant it here.
rewardedVideoClosed() -> UnitAd closed.
rewardServerSuccess() -> UnitServer-to-server reward callback succeeded.
rewardServerFailed() -> UnitServer-to-server reward callback failed.
adLoaded(Ad?) -> UnitAd loaded.
error(Ad?, AdError?) -> UnitLoad/show failed: carries the native Meta AdError (not a VGSDK code).
欄位型別說明
rewardedVideoCompleted() -> Unit獲得的獎勵: 在此發放。
rewardedVideoClosed() -> Unit廣告已關閉。
rewardServerSuccess() -> Unit伺服器對伺服器的獎勵回呼成功。
rewardServerFailed() -> Unit伺服器對伺服器的獎勵回呼失敗。
adLoaded(Ad?) -> Unit廣告已載入。
error(Ad?, AdError?) -> Unit載入/顯示失敗: 帶有原生 Meta AdError(非 VGSDK 代碼)。
字段类型描述
rewardedVideoCompleted() -> Unit获得的奖励: 在此发放。
rewardedVideoClosed() -> Unit广告已关闭。
rewardServerSuccess() -> Unit服务器到服务器的奖励回调成功。
rewardServerFailed() -> Unit服务器到服务器的奖励回调失败。
adLoaded(Ad?) -> Unit广告已加载。
error(Ad?, AdError?) -> Unit加载/展示失败: 携带原生 Meta AdError(非 VGSDK 代码)。

Show rewarded interstitial

Shows a Meta rewarded-interstitial (skippable rewarded format), with the same closure set as rewarded video.

顯示 Meta 獎勵式插頁廣告(可略過的獎勵格式),使用與獎勵影片相同的閉包集合。

展示一个 Meta 激励插屏广告(可跳过的激励格式),闭包集合与激励视频相同。

VGSDKMetaAdsRewardedInterstitialListener listener = new VGSDKMetaAdsRewardedInterstitialListener() {
    @Override
    public void rewardedInterstitialCompleted() { /* grant reward */ }
 
    @Override
    public void error(Ad ad, AdError adError) { /* load/show failed */ }
};
VGSDKMetaAds.showRewardedInterstitial("placement-id", "user-1", "gold", listener);

Input

輸入

输入

FieldTypeDescription
placementIdStringMeta placement id.
userIdStringPlayer id for the reward callback.
currencyStringReward currency name.
listenerVGSDKMetaAdsRewardedInterstitialListenerAd-event listener.
欄位型別說明
placementIdStringMeta 版位 ID。
userIdString用於獎勵回呼的玩家 ID。
currencyString獎勵貨幣名稱。
listenerVGSDKMetaAdsRewardedInterstitialListener廣告事件監聽器。
字段类型描述
placementIdStringMeta 广告位 id。
userIdString用于奖励回调的玩家 id。
currencyString奖励货币名称。
listenerVGSDKMetaAdsRewardedInterstitialListener广告事件监听器。

Output

輸出

输出

FieldTypeDescription
rewardedInterstitialCompleted() -> UnitReward earned: grant it here.
rewardedInterstitialClosed() -> UnitAd closed.
rewardServerSuccess() -> UnitServer-to-server reward callback succeeded.
rewardServerFailed() -> UnitServer-to-server reward callback failed.
adLoaded(Ad?) -> UnitAd loaded.
error(Ad?, AdError?) -> UnitLoad/show failed: carries the native Meta AdError (not a VGSDK code).
欄位型別說明
rewardedInterstitialCompleted() -> Unit獲得的獎勵: 在此發放。
rewardedInterstitialClosed() -> Unit廣告已關閉。
rewardServerSuccess() -> Unit伺服器對伺服器的獎勵回呼成功。
rewardServerFailed() -> Unit伺服器對伺服器的獎勵回呼失敗。
adLoaded(Ad?) -> Unit廣告已載入。
error(Ad?, AdError?) -> Unit載入/顯示失敗: 帶有原生 Meta AdError(非 VGSDK 代碼)。
字段类型描述
rewardedInterstitialCompleted() -> Unit获得的奖励: 在此发放。
rewardedInterstitialClosed() -> Unit广告已关闭。
rewardServerSuccess() -> Unit服务器到服务器的奖励回调成功。
rewardServerFailed() -> Unit服务器到服务器的奖励回调失败。
adLoaded(Ad?) -> Unit广告已加载。
error(Ad?, AdError?) -> Unit加载/展示失败: 携带原生 Meta AdError(非 VGSDK 代码)。

Engage

Re-engagement, grouped by provider. CleverTap covers in-app messaging and the app inbox. Apollo messaging/inbox is backend-driven, so the client’s only touchpoint is the game context it targets on. Firebase Remote Config and the in-app WebView round it out. Firebase Cloud Messaging, local push, Apollo (push / in-app / inbox), and Firebase in-app messages are delivered server-side and expose no client call.

再行銷,依供應商分組。CleverTap 涵蓋應用程式內訊息與應用程式收件匣。Apollo 的訊息/收件匣由後端驅動,因此用戶端唯一的接觸點是它所鎖定的遊戲情境。Firebase Remote Config 與應用程式內 WebView 補足其餘部分。Firebase Cloud Messaging、本機推播、Apollo(推播/應用程式內/收件匣)以及 Firebase 應用程式內訊息皆由伺服器端傳遞,不提供任何用戶端呼叫。

按提供方分组的再互动能力。CleverTap 负责应用内消息和应用收件箱。Apollo 的消息 / 收件箱由后端驱动,因此客户端唯一的接触点是它所定位的游戏上下文。此外还有 Firebase Remote Config 和应用内 WebView。Firebase Cloud Messaging、本地推送、Apollo(推送 / 应用内 / 收件箱)以及 Firebase 应用内消息均由服务端下发,不暴露客户端调用。

CleverTap

Set CleverTap listener

Registers a CleverTap listener for in-app message button taps.

註冊 CleverTap 監聽器以接收應用程式內訊息按鈕的點擊。

注册一个用于监听应用内消息按钮点击的 CleverTap 监听器。

PASS.setCleverTapInAppNotificationButtonListener(new CleverTapInAppNotificationButtonListener() {
    @Override
    public void onCleverTapInAppButtonClick(HashMap<String, String> payload) {
        // Handle the tapped in-app message button payload
    }
});

Input

輸入

输入

FieldTypeDescription
listenerCleverTapInAppNotificationButtonListenerListener for in-app-message button taps.
欄位型別說明
listenerCleverTapInAppNotificationButtonListener用於接收應用程式內訊息按鈕點擊的監聽器。
字段类型描述
listenerCleverTapInAppNotificationButtonListener用于接收应用内消息按钮点击的监听器。

Output

輸出

输出

FieldTypeDescription
onCleverTapInAppButtonClick(HashMap<String, String>?) -> UnitPayload of the tapped in-app message button.
欄位型別說明
onCleverTapInAppButtonClick(HashMap<String, String>?) -> Unit被點擊的應用程式內訊息按鈕的負載。
字段类型描述
onCleverTapInAppButtonClick(HashMap<String, String>?) -> Unit被点击的应用内消息按钮的负载。

Open the app inbox

Opens the CleverTap-backed inbox.

開啟以 CleverTap 為後端的收件匣。

打开由 CleverTap 支持的收件箱。

VGSDKAppInboxCleverTapProvider provider =
    new VGSDKAppInboxCleverTapProvider(new VGSDKAppInboxCleverTapStyle());
VGSDKAppInbox.open(provider, new VGSDKCleverTapInboxListener() {
    @Override
    public void onItemClicked(VGSDKCleverTapInboxMessage message,
                              VGSDKCleverTapInboxMessageContent messageContent,
                              HashMap<String, String> buttonDataPayload) {
        // Handle the tapped message + CTA payload
    }
});

Input

輸入

输入

FieldTypeDescription
providerVGSDKAppInboxCleverTapProviderThe CleverTap app-inbox provider.
provider.styleVGSDKAppInboxCleverTapStyleTheming (title, tabs, colors). Uses defaults when not customized.
listenerVGSDKCleverTapInboxListenerInbox listener.
欄位型別說明
providerVGSDKAppInboxCleverTapProviderCleverTap 應用程式收件匣供應商。
provider.styleVGSDKAppInboxCleverTapStyle主題設定(標題、分頁、色彩)。未自訂時使用預設值。
listenerVGSDKCleverTapInboxListener收件匣監聽器。
字段类型描述
providerVGSDKAppInboxCleverTapProviderCleverTap 应用收件箱提供方。
provider.styleVGSDKAppInboxCleverTapStyle主题设置(标题、标签、颜色)。未自定义时使用默认值。
listenerVGSDKCleverTapInboxListener收件箱监听器。

Output

輸出

输出

FieldTypeDescription
onItemClicked(VGSDKCleverTapInboxMessage, VGSDKCleverTapInboxMessageContent, HashMap<String, String>?) -> UnitThe tapped message, its content, and any CTA button payload.
欄位型別說明
onItemClicked(VGSDKCleverTapInboxMessage, VGSDKCleverTapInboxMessageContent, HashMap<String, String>?) -> Unit被點擊的訊息、其內容,以及任何 CTA 負載。
字段类型描述
onItemClicked(VGSDKCleverTapInboxMessage, VGSDKCleverTapInboxMessageContent, HashMap<String, String>?) -> Unit被点击的消息、其内容以及任何 CTA 负载。

Apollo

Set the game context

Registers the active role/server. Apollo messaging and inbox target on this context, and analytics and support also read it. Both ids must be non-empty or the call is ignored.

註冊使用中的角色/伺服器。Apollo 的訊息與收件匣會以此情境為鎖定目標。分析與支援也會讀取它。兩個 ID 都必須為非空,否則此呼叫會被忽略。

注册当前的角色 / 服务器。Apollo 的消息和收件箱基于此上下文定位。分析与客户支持也会读取它。两个 id 都必须非空,否则该调用被忽略。

VGSDKGameContext context = new VGSDKGameContext("role-1", "server-1");
VGSDK.setGameContext(context);

Input

輸入

输入

FieldTypeDescription
gameContextVGSDKGameContextWrapper describing the active session.
gameContext.roleIdStringActive character/role id (must be non-empty).
gameContext.serverIdStringActive server id (must be non-empty).
欄位型別說明
gameContextVGSDKGameContext描述目前工作階段的包裝物件。
gameContext.roleIdString目前的角色 id(不得為空)。
gameContext.serverIdString目前的伺服器 id(不得為空)。
字段类型描述
gameContextVGSDKGameContext描述当前会话的包装对象。
gameContext.roleIdString当前的角色 id(不得为空)。
gameContext.serverIdString当前的服务器 id(不得为空)。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Registers a listener for deep links fired by Apollo in-app messages / inbox.

註冊監聽器以接收 Apollo 應用程式內訊息/收件匣觸發的深層連結。

注册一个用于监听 Apollo 应用内消息 / 收件箱触发的深链的监听器。

VGSDKAppInbox.setInAppMessageDeepLinkListener(new VGSDKInAppMessageDeepLinkListener() {
    @Override
    public void onDeepLink(String value) { /* route the deep link */ }
});

Input

輸入

输入

FieldTypeDescription
listenerVGSDKInAppMessageDeepLinkListener?The listener to register (pass none to clear it).
欄位型別說明
listenerVGSDKInAppMessageDeepLinkListener?要註冊的監聽器(傳入無則清除)。
字段类型描述
listenerVGSDKInAppMessageDeepLinkListener?要注册的监听器(传入无则清除)。

Output

輸出

输出

FieldTypeDescription
onDeepLink(String) -> UnitThe deep-link URL string to route.
欄位型別說明
onDeepLink(String) -> Unit要路由的深層連結 URL 字串。
字段类型描述
onDeepLink(String) -> Unit要路由的深链 URL 字符串。

Show the app inbox floating button

Displays the Apollo app inbox floating button and takes its visibility over for the rest of the session.

顯示 Apollo 應用程式內收件匣的浮動按鈕,並在本次工作階段接手其顯示與隱藏。

显示 Apollo 应用内收件箱的悬浮按钮,并在本次会话接手其显示与隐藏。

The first call to either visibility method hands the button to your game for the rest of the session, so the SDK stops showing and hiding it on its own. The hand over resets on logout and on relaunch. A call made while the app inbox is disabled for your game is accepted and reported in the SDK log as having no effect.

第一次呼叫任一個顯示控制方法後,按鈕即在本次工作階段交由遊戲控制,SDK 不再自行顯示或隱藏它。此控制權會在登出與重新啟動時歸還 SDK。若你的遊戲未啟用應用程式內收件匣,呼叫仍會被接受,並在 SDK 日誌中回報為未產生效果。

第一次调用任一个显示控制方法后,按钮即在本次会话交由游戏控制,SDK 不再自行显示或隐藏它。该控制权会在登出与重新启动时归还 SDK。若你的游戏未启用应用内收件箱,调用仍会被接受,并在 SDK 日志中报告为未产生效果。

VGSDKAppInbox.showFloatingButton();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Hide the app inbox floating button

Removes the Apollo app inbox floating button and takes its visibility over for the rest of the session.

移除 Apollo 應用程式內收件匣的浮動按鈕,並在本次工作階段接手其顯示與隱藏。

移除 Apollo 应用内收件箱的悬浮按钮,并在本次会话接手其显示与隐藏。

The dismiss zone and any open confirmation popup go with it, and a drag in progress is cancelled immediately. The button’s last position survives, so a later show restores it. An open message list is left untouched, and a message arriving while the button is hidden still updates the unread count.

移除按鈕時,拖曳關閉區與任何開啟中的確認彈窗會一併移除,正在進行的拖曳也會立即取消。按鈕最後的位置會保留,因此之後呼叫顯示時會回到原處。開啟中的訊息列表不受影響,按鈕隱藏期間收到的訊息仍會更新未讀數量。

移除按钮时,拖拽关闭区与任何打开中的确认弹窗会一并移除,正在进行的拖拽也会立即取消。按钮最后的位置会保留,因此之后调用显示时会回到原处。打开中的消息列表不受影响,按钮隐藏期间收到的消息仍会更新未读数量。

VGSDKAppInbox.hideFloatingButton();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Firebase

Fetch Firebase Remote Config

Fetches all remote-config keys.

取得所有 remote-config 鍵。

获取所有 remote-config 键。

PASS.fetchConfig(new RemoteConfigListener() {
    @Override
    public void onSuccess(Map<?, ?> configInfo) {
        // Read configInfo.get("your_key")
    }
 
    @Override
    public void onFail() { /* fetch failed */ }
});

Input

輸入

输入

FieldTypeDescription
listenerRemoteConfigListenerFetch-result listener. Override onSuccess/onFail.
欄位型別說明
listenerRemoteConfigListener擷取結果監聽器。覆寫 onSuccess/onFail
字段类型描述
listenerRemoteConfigListener获取结果监听器。重写 onSuccess/onFail

Output

輸出

输出

FieldTypeDescription
onSuccess(Map<*, *>) -> UnitAll remote-config keys and values.
onFail() -> UnitFetch failed (no error payload).
欄位型別說明
onSuccess(Map<*, *>) -> Unit所有遠端設定的鍵與值。
onFail() -> Unit擷取失敗(無錯誤負載)。
字段类型描述
onSuccess(Map<*, *>) -> Unit所有远程配置的键与值。
onFail() -> Unit获取失败(无错误负载)。

In-App WebView

Show in-app WebView

Opens a URL in an in-app WebView.

在應用程式內 WebView 中開啟一個 URL。

在应用内 WebView 中打开一个 URL。

PASS.showWebView("https://example.com", new ShowPageListener() {
    @Override
    public void onComplete() { /* WebView dismissed */ }
 
    @Override
    public void onError(Error error) { /* failed to open */ }
});

Input

輸入

输入

FieldTypeDescription
urlString?URL to load.
pageListenerShowPageListenerWebView lifecycle listener.
欄位型別說明
urlString?要載入的 URL。
pageListenerShowPageListenerWebView 生命週期監聽器。
字段类型描述
urlString?要加载的 URL。
pageListenerShowPageListenerWebView 生命周期监听器。

Output

輸出

输出

FieldTypeDescription
onComplete() -> UnitFires when the WebView is dismissed.
onError(Error?) -> UnitFailed to open the WebView: an Error wrapping a message string (no VGSDK code).
欄位型別說明
onComplete() -> Unit當 WebView 關閉時觸發。
onError(Error?) -> Unit開啟 WebView 失敗: 一個包裝訊息字串的 Error(無 VGSDK 代碼)。
字段类型描述
onComplete() -> Unit当 WebView 关闭时触发。
onError(Error?) -> Unit打开 WebView 失败: 一个包装消息字符串的 Error(无 VGSDK 代码)。

Notification

Add a custom sound

Deliver a custom sound with push notifications: no API call, just ship the audio file with your app:

  1. Prepare the sound file: .mp3 / .wav / .ogg, a short tone. The filename must be lowercase letters, digits, and underscores only ([a-z0-9_]), since it becomes a resource name.
  2. Put it in res/raw/ of your app module.
  3. Reference it by resource name in the push payload’s sound field: the extension is ignored (my_notification and my_notification.mp3 both resolve res/raw/my_notification). If the name doesn’t resolve, the default notification sound is used.

為推播通知提供自訂音效:無需 API 呼叫,只要將音訊檔隨應用程式一起打包:

  1. 準備音效檔.mp3 / .wav / .ogg,一段簡短的提示音。檔名只能使用小寫字母、數字與底線([a-z0-9_]),因為它會成為資源名稱。
  2. 將其放入應用程式模組的 res/raw/
  3. 於推播負載的 sound 欄位中以資源名稱參照它:副檔名會被忽略(my_notificationmy_notification.mp3 都會解析到 res/raw/my_notification)。若名稱無法解析,則使用預設通知音效。

为推送通知提供自定义声音:无需 API 调用,只需将音频文件随应用一起打包:

  1. 准备声音文件.mp3 / .wav / .ogg,一段简短的提示音。文件名只能使用小写字母、数字和下划线([a-z0-9_]),因为它会成为资源名。
  2. 将其放入应用模块的 res/raw/
  3. 在推送负载的 sound 字段中按资源名引用它:扩展名会被忽略(my_notificationmy_notification.mp3 都会解析到 res/raw/my_notification)。若名称无法解析,则使用默认通知声音。

Set the notification icon

Show a custom notification icon on Android:

  1. Prepare two icons: a small icon at 128×128 and a large icon at 256×256 (px).
  2. Create small_icon_notification.png and large_icon_notification.png from them, and save both in the res/drawable folder.
  3. Add the following to AndroidManifest.xml:

在 Android 上顯示自訂通知圖示:

  1. 準備兩個圖示小圖示 128×128、大圖示 256×256(像素)。
  2. 依此建立 small_icon_notification.pnglarge_icon_notification.png,並將兩者儲存至 res/drawable 資料夾。
  3. 將以下內容加入 AndroidManifest.xml

在 Android 上显示自定义通知图标:

  1. 准备两个图标小图标 128×128、大图标 256×256(像素)。
  2. 据此创建 small_icon_notification.pnglarge_icon_notification.png,并将两者保存到 res/drawable 文件夹。
  3. 将以下内容添加AndroidManifest.xml
<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/small_icon_notification"
    tools:replace="android:resource" />

Set the notification icon color

Tint the notification icon shown in the drop-down notification tray:

  1. Create res/values/color.xml if it doesn’t exist.
  2. Add a colorNotification entry: set its value to the HEX color you want (replace {your_icon_color}), for example #EC7710:

為下拉通知欄中顯示的通知圖示著色:

  1. 若不存在,建立 res/values/color.xml
  2. 加入 colorNotification 項目:將其值設為你想要的 HEX 色彩(替換 {your_icon_color}),例如 #EC7710

为下拉通知栏中显示的通知图标着色:

  1. 若不存在,创建 res/values/color.xml
  2. 添加 colorNotification 条目:将其值设为你想要的 HEX 颜色(替换 {your_icon_color}),例如 #EC7710
<color name="colorNotification">#EC7710</color>

Social

Read Facebook profile/friends and share to Facebook or Instagram. Facebook results are the raw Graph JSON (no typed model). Instagram callbacks return only an error (none = success).

讀取 Facebook 個人檔案/好友,並分享到 Facebook 或 Instagram。Facebook 的結果為原始的 Graph JSON(沒有型別化模型)。Instagram 的回呼僅傳回一個錯誤(不存在=成功)。

读取 Facebook 资料 / 好友,并分享到 Facebook 或 Instagram。Facebook 结果是原始的 Graph JSON(没有类型化模型)。Instagram 回调仅返回一个错误(不存在 = 成功)。

Get Facebook profile

Returns the player’s Facebook profile as raw Graph JSON.

以原始 Graph JSON 傳回玩家的 Facebook 個人檔案。

以原始 Graph JSON 形式返回玩家的 Facebook 资料。

PASS.getProfileSocial(SocialType.FACEBOOK, new SocialListener<SocialUserInfo>() {
    @Override
    public void onSuccess(SocialUserInfo profile) {
        // Typed model: profile.userID, profile.name, profile.avatarImageURL
    }
 
    @Override
    public void onFail(String message) { /* handle failure */ }
 
    @Override
    public void onCancel() { /* user dismissed */ }
});

Input

輸入

输入

FieldTypeDescription
socialTypeSocialTypeSocial channel to read (Facebook): see SocialType.
listenerSocialListener<SocialUserInfo>Result listener (onSuccess / onFail / onCancel).
欄位型別說明
socialTypeSocialType要讀取的社群頻道(Facebook): 請參閱 SocialType
listenerSocialListener<SocialUserInfo>結果監聽器(onSuccess / onFail / onCancel)。
字段类型描述
socialTypeSocialType要读取的社交渠道(Facebook): 请参阅 SocialType
listenerSocialListener<SocialUserInfo>结果监听器(onSuccess / onFail / onCancel)。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: SocialUserInfo) -> UnitDelivers the typed profile model (not raw JSON). Fields: SocialUserInfo.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: SocialUserInfo) -> Unit傳回具型別的個人檔案模型(非原始 JSON)。欄位詳見 SocialUserInfo
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: SocialUserInfo) -> Unit返回带类型的资料模型(非原始 JSON)。字段详见 SocialUserInfo
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Get Facebook friends

Returns friends using the app as raw Graph dictionaries.

以原始 Graph 字典傳回正在使用此應用程式的好友。

以原始 Graph 字典形式返回正在使用该应用的好友。

PASS.getFriendsSocial(new GetFriendsSocialType.Facebook(0, 50),
    new SocialListener<List<SocialUserInfo>>() {
        @Override
        public void onSuccess(List<SocialUserInfo> friends) { /* app friends */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
getFriendsSocialTypeGetFriendsSocialType.FacebookFacebook friends query: full model: GetFriendsSocialType.
listenerSocialListener<List<SocialUserInfo>>Result listener (onSuccess / onFail / onCancel).
欄位型別說明
getFriendsSocialTypeGetFriendsSocialType.FacebookFacebook 好友查詢: 完整模型:GetFriendsSocialType
listenerSocialListener<List<SocialUserInfo>>結果監聽器(onSuccess / onFail / onCancel)。
字段类型描述
getFriendsSocialTypeGetFriendsSocialType.FacebookFacebook 好友查询: 完整模型:GetFriendsSocialType
listenerSocialListener<List<SocialUserInfo>>结果监听器(onSuccess / onFail / onCancel)。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: List<SocialUserInfo>) -> UnitDelivers the app friends as typed models (not raw JSON). Each entry: SocialUserInfo.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: List<SocialUserInfo>) -> Unit以具型別的模型傳回使用此應用程式的好友(非原始 JSON)。每個項目:SocialUserInfo
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: List<SocialUserInfo>) -> Unit以带类型的模型返回使用该应用的好友(非原始 JSON)。每个条目:SocialUserInfo
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Invite Facebook friends

Opens the Facebook invite dialog.

開啟 Facebook 邀請對話框。

打开 Facebook 邀请对话框。

PASS.inviteFriends(
    new InviteFriendsSocialType.Facebook("Join!", SocialFriendType.APP_USERS),
    new SocialListener<List<String>>() {
        @Override
        public void onSuccess(List<String> invitedIds) { /* invited friend ids */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
inviteFriendsSocialTypeInviteFriendsSocialType.FacebookFacebook invite request: full model: InviteFriendsSocialType.
listenerSocialListener<List<String>>Result listener (onSuccess / onFail / onCancel).
欄位型別說明
inviteFriendsSocialTypeInviteFriendsSocialType.FacebookFacebook 邀請請求: 完整模型:InviteFriendsSocialType
listenerSocialListener<List<String>>結果監聽器(onSuccess / onFail / onCancel)。
字段类型描述
inviteFriendsSocialTypeInviteFriendsSocialType.FacebookFacebook 邀请请求: 完整模型:InviteFriendsSocialType
listenerSocialListener<List<String>>结果监听器(onSuccess / onFail / onCancel)。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: List<String>) -> UnitIds of the friends that were invited.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: List<String>) -> Unit已被邀請的好友 id。
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: List<String>) -> Unit已被邀请的好友 id。
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Share photo to Facebook

Shares a photo through the Facebook share dialog.

透過 Facebook 分享對話框分享相片。

通过 Facebook 分享对话框分享一张照片。

// bitmap: the android.graphics.Bitmap to share
PASS.shareToSocial(new ShareType.FacebookPhoto("Check this out", bitmap),
    new SocialListener<Object>() {
        @Override
        public void onSuccess(Object result) { /* shared */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
shareTypeShareType.FacebookPhotoFacebook photo share (via shareToSocial): full model: ShareType.
listenerSocialListener<Any>Result listener. Facebook shares resolve the result to Any/Object.
欄位型別說明
shareTypeShareType.FacebookPhotoFacebook 相片分享(透過 shareToSocial): 完整模型:ShareType
listenerSocialListener<Any>結果監聽器。Facebook 分享會將結果解析為 Any/Object。
字段类型描述
shareTypeShareType.FacebookPhotoFacebook 照片分享(通过 shareToSocial): 完整模型:ShareType
listenerSocialListener<Any>结果监听器。Facebook 分享会将结果解析为 Any/Object。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: Any) -> UnitThe photo was shared.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: Any) -> Unit相片已分享。
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: Any) -> Unit照片已分享。
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Shares a link.

分享連結。

分享一个链接。

PASS.shareToSocial(
    new ShareType.FacebookLink("Title", "Description", "https://example.com", null),
    new SocialListener<Object>() {
        @Override
        public void onSuccess(Object result) { /* shared */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
shareTypeShareType.FacebookLinkFacebook link share (via shareToSocial): full model: ShareType.
listenerSocialListener<Any>Result listener. Facebook shares resolve the result to Any/Object.
欄位型別說明
shareTypeShareType.FacebookLinkFacebook 連結分享(透過 shareToSocial): 完整模型:ShareType
listenerSocialListener<Any>結果監聽器。Facebook 分享會將結果解析為 Any/Object。
字段类型描述
shareTypeShareType.FacebookLinkFacebook 链接分享(通过 shareToSocial): 完整模型:ShareType
listenerSocialListener<Any>结果监听器。Facebook 分享会将结果解析为 Any/Object。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: Any) -> UnitThe link was shared.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: Any) -> Unit連結已分享。
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: Any) -> Unit链接已分享。
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Share to Instagram feed

Shares an image to the Instagram feed.

將圖片分享到 Instagram 動態。

将一张图片分享到 Instagram 动态。

// imageUri: android.net.Uri of the image to share
PASS.shareToSocial(new ShareType.InstagramPhotoFeed(imageUri),
    new SocialListener<String>() {
        @Override
        public void onSuccess(String result) { /* shared */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
shareTypeShareType.InstagramPhotoFeedInstagram feed image share (via shareToSocial): full model: ShareType.
listenerSocialListener<String>Result listener. Instagram shares resolve the result to String.
欄位型別說明
shareTypeShareType.InstagramPhotoFeedInstagram 動態圖片分享(透過 shareToSocial): 完整模型:ShareType
listenerSocialListener<String>結果監聽器。Instagram 分享會將結果解析為 String。
字段类型描述
shareTypeShareType.InstagramPhotoFeedInstagram 动态图片分享(通过 shareToSocial): 完整模型:ShareType
listenerSocialListener<String>结果监听器。Instagram 分享会将结果解析为 String。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: String) -> UnitThe image was shared to the Instagram feed.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: String) -> Unit圖片已分享到 Instagram 動態。
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: String) -> Unit图片已分享到 Instagram 动态。
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

Share to Instagram Stories

Shares an image to Instagram Stories.

將圖片分享到 Instagram 限時動態。

将一张图片分享到 Instagram 快拍。

// imageUri: android.net.Uri of the image to share
PASS.shareToSocial(new ShareType.InstagramPhotoStory(imageUri),
    new SocialListener<String>() {
        @Override
        public void onSuccess(String result) { /* shared */ }
 
        @Override
        public void onFail(String message) { /* handle failure */ }
 
        @Override
        public void onCancel() { /* user dismissed */ }
    });

Input

輸入

输入

FieldTypeDescription
shareTypeShareType.InstagramPhotoStoryInstagram Stories image share (via shareToSocial): full model: ShareType.
listenerSocialListener<String>Result listener. Instagram shares resolve the result to String.
欄位型別說明
shareTypeShareType.InstagramPhotoStoryInstagram 限時動態圖片分享(透過 shareToSocial): 完整模型:ShareType
listenerSocialListener<String>結果監聽器。Instagram 分享會將結果解析為 String。
字段类型描述
shareTypeShareType.InstagramPhotoStoryInstagram 快拍图片分享(通过 shareToSocial): 完整模型:ShareType
listenerSocialListener<String>结果监听器。Instagram 分享会将结果解析为 String。

Output

輸出

输出

FieldTypeDescription
onSuccess(result: String) -> UnitThe image was shared to Instagram Stories.
onFail(message: String?) -> UnitCalled on failure with an error message.
onCancel() -> UnitCalled when the player dismisses the flow.
欄位型別說明
onSuccess(result: String) -> Unit圖片已分享到 Instagram 限時動態。
onFail(message: String?) -> Unit失敗時呼叫,並帶有錯誤訊息。
onCancel() -> Unit當玩家關閉流程時呼叫。
字段类型描述
onSuccess(result: String) -> Unit图片已分享到 Instagram 快拍。
onFail(message: String?) -> Unit失败时调用,并带有错误消息。
onCancel() -> Unit当玩家关闭流程时调用。

User Experience

Native store rating prompt and in-chat Google Translate.

原生商店評分提示與聊天內的 Google Translate。

原生商店评分提示,以及聊天内的 Google Translate。

Store rating (in-app review)

Triggers the native in-app review sheet (subject to the OS’s display limits).

觸發原生應用程式內評論表單(受作業系統的顯示限制約束)。

触发原生应用内评价面板(受操作系统的展示限制约束)。

PASS.rating();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

No return value (fire-and-forget).

無回傳值(fire-and-forget)。

无返回值(fire-and-forget)。

Translate text

Translates text into a target language via Google Translate. The result is delivered asynchronously.

透過 Google Translate 將文字翻譯為目標語言。結果會以非同步方式傳回。

通过 Google Translate 将文本翻译为目标语言。结果异步返回。

PASS.translate("Hello", "vi", new TranslateListener() {
    @Override
    public void onComplete(String output) {
        // output == "Xin chào"
    }
});

Input

輸入

输入

FieldTypeDescription
textStringText to translate.
languageStringTarget language code (e.g. “vi”).
欄位型別說明
textString要翻譯的文字。
languageString目標語言代碼(例如 “vi”)。
字段类型描述
textString要翻译的文本。
languageString目标语言代码(例如 “vi”)。

Output

輸出

输出

FieldTypeDescription
outputStringThe translated text.
欄位型別說明
outputString翻譯後的文字。
字段类型描述
outputString翻译后的文本。

SDK Information

Read-only accessors for SDK, device, and current-user information: SDK version, active language, detected country, device id, and the signed-in user. All are static accessors. None take input.

用於讀取 SDK、裝置與目前使用者資訊的唯讀存取器: SDK 版本、使用中的語言、偵測到的國家/地區、裝置 ID,以及已登入的使用者。全部皆為靜態存取器。均不需輸入。

SDK、设备与当前用户信息的只读访问器: SDK 版本、当前语言、检测到的国家 / 地区、设备 id 以及已登录的用户。它们都是静态访问器。均不接受输入。

Get SDK version

Returns the VNGGames SDK version.

傳回 VNGGames SDK 版本。

返回 VNGGames SDK 版本。

String version = PASS.getSDKVersion();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
versionStringThe SDK version string.
欄位型別說明
versionStringSDK 版本字串。
字段类型描述
versionStringSDK 版本字符串。

Get current language

Returns the SDK’s active language code.

傳回 SDK 使用中的語言代碼。

返回 SDK 的当前语言代码。

String language = PASS.getLanguage();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
languageStringActive language code (e.g. “vi”, “en”).
欄位型別說明
languageString使用中的語言代碼(例如 “vi”、“en”)。
字段类型描述
languageString当前语言代码(例如 “vi”、“en”)。

Get current user

Returns the signed-in user, or none when no session exists.

傳回已登入的使用者。若不存在工作階段則為無。

返回已登录的用户,若不存在会话则为无。

UserInfo user = PASS.getCurrentUserInfo();
if (user != null) {
    // user.userId, user.displayName, user.sessionId
}

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
userUserInfo?The signed-in user, or absent when no session exists. Fields: UserInfo.
欄位型別說明
userUserInfo?已登入的使用者。沒有工作階段時不存在。欄位詳見 UserInfo
字段类型描述
userUserInfo?已登录的用户。没有会话时不存在。字段详见 UserInfo

Get current country code

Returns the player’s country code when it is one of the game’s publish-market countries, otherwise returns OT (other).

當玩家的國家/地區屬於遊戲發行市場的國家之一時傳回其代碼。否則傳回 OT(其他)。

当玩家的国家 / 地区代码属于游戏发行市场之一时返回该代码。否则返回 OT(其他)。

String code = PASS.getCountryCode();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
countryCodeString?The player’s country code, or OT (other) when outside the game’s publish market. Absent when not yet detected.
欄位型別說明
countryCodeString?玩家的國家/地區代碼。位於遊戲發行市場之外時為 OT(其他)。尚未偵測到時不存在。
字段类型描述
countryCodeString?玩家的国家 / 地区代码。位于游戏发行市场之外时为 OT(其他)。尚未检测到时不存在。

Get device id

Returns a per-device identifier: the advertising id when available, otherwise a fallback device id: used when the advertising id is unavailable or all-zero (e.g. tracking not authorized). Dashes are replaced with underscores.

傳回每台裝置的識別碼:可用時為廣告識別碼,否則為備用裝置識別碼: 於廣告識別碼無法使用或全為零時使用(例如未授權追蹤)。連字號會以底線取代。

返回每设备标识符:可用时为广告标识符,否则为备用设备标识符: 在广告标识符不可用或全为零时使用(例如未授权跟踪)。连字符会被替换为下划线。

String deviceId = PASS.getDeviceID();

Input

輸入

输入

No input.

無輸入。

无输入。

Output

輸出

输出

FieldTypeDescription
deviceIdString?Advertising id when available, otherwise a fallback device id, with dashes replaced by underscores. Absent when unavailable.
欄位型別說明
deviceIdString?可用時為廣告識別碼。否則為備用裝置識別碼,連字號會以底線取代。無法取得時不存在。
字段类型描述
deviceIdString?可用时为广告标识符。否则为备用设备标识符,连字符会替换为下划线。无法获取时不存在。

Data Models

Shared objects and enums referenced by multiple methods, documented once here. For enums, each row is one case: Field = the case, Type = its raw value.

由多個方法參考的共用物件與列舉,於此處統一說明一次。對於列舉,每一列代表一個 case: Field=該 case,Type=其原始值。

被多个方法引用的共享对象与枚举,在此统一记录一次。对于枚举,每一行是一个枚举项: Field = 该枚举项,Type = 其原始值。

VGSDKSupportInfo

Player context passed to Open support center.

傳入「開啟客服中心」的玩家情境。

传入“打开客服中心”的玩家上下文。

Fields

欄位

字段

FieldTypeDescription
userIdString?Unique VNGGames user id.
serverIdString?Game server id.
levelString?Player level.
roleNameString?Character/role name.
loginChannelString?Login channel.
guildString?Guild name.
contentString?Pre-filled ticket content.
欄位型別說明
userIdString?VNGGames 唯一使用者 id。
serverIdString?遊戲伺服器 id。
levelString?玩家等級。
roleNameString?角色名稱。
loginChannelString?登入頻道。
guildString?公會名稱。
contentString?預先填入的工單內容。
字段类型描述
userIdString?唯一的 VNGGames 用户 id。
serverIdString?游戏服务器 id。
levelString?玩家等级。
roleNameString?角色名称。
loginChannelString?登录渠道。
guildString?公会名称。
contentString?预填的工单内容。

VGSDKAnalyticsProvider

Analytics provider selector for sendCustomEvent (Int enum).

sendCustomEvent 的分析供應商選擇器(Int 列舉)。

sendCustomEvent 的分析提供方选择器(Int 枚举)。

Fields

欄位

字段

FieldTypeDescription
.appsFlyer0AppsFlyer.
.firebase1Firebase Analytics.
.dataPlatform2VNGGames Data Platform.
.facebook3Facebook App Events.
.thinkingData4ThinkingData.
.cleverTap5CleverTap.
欄位型別說明
.appsFlyer0AppsFlyer。
.firebase1Firebase Analytics。
.dataPlatform2VNGGames Data Platform。
.facebook3Facebook App Events。
.thinkingData4ThinkingData。
.cleverTap5CleverTap。
字段类型描述
.appsFlyer0AppsFlyer。
.firebase1Firebase Analytics。
.dataPlatform2VNGGames 数据平台。
.facebook3Facebook App Events。
.thinkingData4ThinkingData。
.cleverTap5CleverTap。

Analytics default parameters

The default parameters the analytics facade merges into every event it triggers. The SDK fills them automatically: you never set them, and each method’s own inputs and any extraData you pass are added on top. device_info, user_info, response_info, and login_info are JSON-encoded strings. The last two are conditional: see their rows. Used by every method in Analytics.

分析門面合併到它所觸發之每個事件的預設參數。SDK 會自動填入: 你永遠不需設定。每個方法自身的輸入以及你傳入的任何 extraData 會再疊加於其上。device_infouser_inforesponse_infologin_info 為 JSON 編碼字串。後兩者為條件性: 請參閱其對應列。由 分析 中的每個方法使用。

分析门面合并到它触发的每个事件中的默认参数。SDK 会自动填充它们: 你无需设置。每个方法自身的输入以及你传入的任何 extraData 都会叠加在其之上。device_infouser_inforesponse_infologin_info 是 JSON 编码的字符串。后两个是条件性的: 见其对应行。分析 中的每个方法都会使用它们。

Fields

欄位

字段

FieldTypeDescription
device_infoStringDevice info, JSON-encoded: os (the platform name), version (OS version), model (device model).
device_idStringPer-device id (advertising id when available, otherwise a fallback device id, prefixed).
game_versionStringFull game (app) version.
sdk_versionStringVNGGames SDK version.
packageStringGame bundle id / package name.
network_typeStringActive network type at send time.
timestampStringEvent time, in milliseconds.
session_idStringAnalytics session id: a UUID generated once per app run.
user_infoStringSigned-in user info, JSON-encoded: user_id, social_id, country_code. Ids are empty while signed out.
appsflyer_idStringAppsFlyer device UID.
frb_installation_idStringFirebase installation id.
frb_app_instance_idStringFirebase app-instance id.
response_infoStringAdded only on events that report an outcome. JSON-encoded: status (Success / Failed / Canceled), error_code, remote (0 local, 1 remote).
login_infoStringAdded only on login-flow events. JSON-encoded: method, channel, flow (CreateUser / UpdateUser), step.
欄位型別說明
device_infoString裝置資訊,JSON 編碼:os(平台名稱)、version(作業系統版本)、model(裝置型號)。
device_idString每台裝置的 ID(可用時為廣告 ID,否則為備用裝置 ID。含前綴)。
game_versionString完整的遊戲(應用程式)版本。
sdk_versionStringVNGGames SDK 版本。
packageString遊戲的 bundle id/套件名稱。
network_typeString傳送當下使用中的網路類型。
timestampString事件時間,以毫秒為單位。
session_idString分析工作階段 ID: 每次應用程式執行時產生一次的 UUID。
user_infoString已登入使用者資訊,JSON 編碼:user_idsocial_idcountry_code。登出時這些 ID 為空。
appsflyer_idStringAppsFlyer 裝置 UID。
frb_installation_idStringFirebase 安裝 ID。
frb_app_instance_idStringFirebase 應用程式執行個體 ID。
response_infoString僅在回報結果的事件上加入。JSON 編碼:statusSuccessFailedCanceled)、error_coderemote0 本機、1 遠端)。
login_infoString僅在登入流程事件上加入。JSON 編碼:methodchannelflowCreateUserUpdateUser)、step
字段类型描述
device_infoString设备信息,JSON 编码:os(平台名称)、version(操作系统版本)、model(设备型号)。
device_idString每设备 id(可用时为广告 id,否则为备用设备 id。带前缀)。
game_versionString完整的游戏(应用)版本。
sdk_versionStringVNGGames SDK 版本。
packageString游戏 bundle id / 包名。
network_typeString发送时的当前网络类型。
timestampString事件时间,以毫秒为单位。
session_idString分析会话 id: 每次应用运行生成一次的 UUID。
user_infoString已登录用户信息,JSON 编码:user_idsocial_idcountry_code。未登录时这些 id 为空。
appsflyer_idStringAppsFlyer 设备 UID。
frb_installation_idStringFirebase 安装 id。
frb_app_instance_idStringFirebase 应用实例 id。
response_infoString仅在报告结果的事件上添加。JSON 编码:statusSuccess / Failed / Canceled)、error_coderemote0 本地,1 远程)。
login_infoString仅在登录流程事件上添加。JSON 编码:methodchannelflowCreateUser / UpdateUser)、step

Analytics platform prefixes

The per-provider prefix the VNGGames SDK inserts into every event it triggers: each event reaches its provider as vgsdk_{prefix}_{event name} (for example, vgsdk_af_app_open). Used by every method in Analytics.

VNGGames SDK 插入到它所觸發之每個事件中的各供應商前綴: 每個事件會以 vgsdk_{prefix}_{event name} 抵達其供應商(例如 vgsdk_af_app_open)。由 分析 中的每個方法使用。

VNGGames SDK 插入到它触发的每个事件中的每提供方前缀: 每个事件以 vgsdk_{prefix}_{event name} 形式到达其提供方(例如 vgsdk_af_app_open)。分析 中的每个方法都会使用它。

Fields

欄位

字段

FieldTypeDescription
FirebasefrbFirebase Analytics.
FacebookfbFacebook App Events.
AppsFlyerafAppsFlyer.
Data PlatformdpVNGGames Data Platform.
CleverTapcltCleverTap.
ThinkingDatatdThinkingData.
欄位型別說明
FirebasefrbFirebase Analytics。
FacebookfbFacebook App Events。
AppsFlyerafAppsFlyer。
Data PlatformdpVNGGames Data Platform。
CleverTapcltCleverTap。
ThinkingDatatdThinkingData。
字段类型描述
FirebasefrbFirebase Analytics。
FacebookfbFacebook App Events。
AppsFlyerafAppsFlyer。
Data PlatformdpVNGGames 数据平台。
CleverTapcltCleverTap。
ThinkingDatatdThinkingData。

Ad revenue mediation network

Mediation network for ad-revenue reporting (UInt enum), used by miscAdRevenue.

用於廣告收益回報的中介聯播網(UInt 列舉),由 miscAdRevenue 使用。

用于广告收入上报的聚合网络(UInt 枚举),由 miscAdRevenue 使用。

Fields

欄位

字段

FieldTypeDescription
.googleAdMob1Google AdMob.
.ironSource2ironSource.
.applovinMax3AppLovin MAX.
.fyber4Fyber.
.appodeal5Appodeal.
.admost6Admost.
.topon7TopOn.
.tradplus8TradPlus.
.yandex9Yandex.
.chartBoost10Chartboost.
.unity11Unity Ads.
.custom12Custom.
.directMonetization13Direct monetization.
欄位型別說明
.googleAdMob1Google AdMob。
.ironSource2ironSource。
.applovinMax3AppLovin MAX。
.fyber4Fyber。
.appodeal5Appodeal。
.admost6Admost。
.topon7TopOn。
.tradplus8TradPlus。
.yandex9Yandex。
.chartBoost10Chartboost。
.unity11Unity Ads。
.custom12自訂。
.directMonetization13直接營利。
字段类型描述
.googleAdMob1Google AdMob。
.ironSource2ironSource。
.applovinMax3AppLovin MAX。
.fyber4Fyber。
.appodeal5Appodeal。
.admost6Admost。
.topon7TopOn。
.tradplus8TradPlus。
.yandex9Yandex。
.chartBoost10Chartboost。
.unity11Unity Ads。
.custom12自定义。
.directMonetization13直接变现。

SocialType

The login channel: passed to Direct login to sign in to a specific channel, and to the social profile/friends calls to select the network (Facebook is supported). The Type column is each case’s JSON-serialized value.

登入頻道: 傳入「直接登入」以登入特定頻道,並傳入社群個人檔案/好友呼叫以選擇網路(支援 Facebook)。Type 欄位為各項目的 JSON 序列化值。

登录渠道: 传入“直接登录”以登录特定渠道,并传入社交资料/好友调用以选择网络(支持 Facebook)。Type 列为各项的 JSON 序列化值。

Fields

欄位

字段

FieldTypeDescription
.FACEBOOKFacebookFacebook.
.ZINGIDZingIDZing ID.
.GOOGLEGoogleGoogle.
.EMAILEmailEmail.
.GUESTGuestAnonymous guest.
.INSTAGRAMInstagramInstagram.
.APPLEAppleSign in with Apple.
欄位型別說明
.FACEBOOKFacebookFacebook。
.ZINGIDZingIDZing ID。
.GOOGLEGoogleGoogle。
.EMAILEmail電子郵件。
.GUESTGuest匿名訪客。
.INSTAGRAMInstagramInstagram。
.APPLEApple使用 Apple 登入。
字段类型描述
.FACEBOOKFacebookFacebook。
.ZINGIDZingIDZing ID。
.GOOGLEGoogleGoogle。
.EMAILEmail电子邮箱。
.GUESTGuest匿名访客。
.INSTAGRAMInstagramInstagram。
.APPLEAppleSign in with Apple。

UserInfo

The signed-in player, delivered by every login callback and by the current-user accessor.

已登入的玩家,由每個登入回呼以及目前使用者存取器傳回。

已登录的玩家,由每个登录回调以及当前用户访问器返回。

Fields

欄位

字段

FieldTypeDescription
userIdString?Unique VNGGames user id.
sessionIdString?Session token used to authenticate backend calls.
displayNameString?Player display name.
lastUpdateSessionLongEpoch millis of the last session refresh.
mapBooleanWhether the account is protected/secured.
loginType()IntAccessor: the login channel value: 1 Facebook, 3 Google, 4 ZingID, 5 Guest, 7 Apple, 8 Email.
loginTypeForTracking()StringThe login channel as a string.
欄位型別說明
userIdString?VNGGames 唯一使用者 id。
sessionIdString?用於驗證後端呼叫的工作階段權杖。
displayNameString?玩家顯示名稱。
lastUpdateSessionLong上次工作階段重新整理的 Epoch 毫秒數。
mapBoolean帳號是否受保護/已加固。
loginType()Int存取器: 登入頻道值:1 Facebook、3 Google、4 ZingID、5 Guest、7 Apple、8 Email。
loginTypeForTracking()String以字串表示的登入頻道。
字段类型描述
userIdString?唯一的 VNGGames 用户 id。
sessionIdString?用于验证后端调用的会话令牌。
displayNameString?玩家显示名称。
lastUpdateSessionLong最近一次会话刷新的 Epoch 毫秒数。
mapBoolean账号是否受保护 / 已加固。
loginType()Int访问器: 登录渠道值:1 Facebook、3 Google、4 ZingID、5 Guest、7 Apple、8 Email。
loginTypeForTracking()String以字符串表示的登录渠道。

SkuDetails

A sellable product returned by Get products.

由「取得商品」傳回的可販售商品。

由“获取商品”返回的可售卖商品。

Fields

欄位

字段

FieldTypeDescription
skuString?The configured item id from Store.
priceString?Store-formatted price string to show the player.
priceMicrosString?Price in micro-units, as a string: 1,000,000 = one currency unit.
currencyString?ISO currency code.
欄位型別說明
skuString?在商店設定的商品 id。
priceString?商店格式化後、用於向玩家顯示的價格字串。
priceMicrosString?以微單位表示、字串形式的價格: 1,000,000 = 一個 currency 單位。
currencyString?ISO 貨幣代碼。
字段类型描述
skuString?在商店配置的商品 id。
priceString?商店格式化后、用于向玩家展示的价格字符串。
priceMicrosString?以微单位表示、字符串形式的价格: 1,000,000 = 一个 currency 单位。
currencyString?ISO 货币代码。

PaymentInfo

The purchase request passed to Purchase.

傳入「購買」的購買請求。

传入“购买”的购买请求。

Fields

欄位

字段

FieldTypeDescription
userIDStringBuyer’s VNGGames user id.
serverIDStringGame server id.
itemIDStringThe configured item id from Store.
appTransIDStringYour app-side transaction id, for reconciliation.
addInfoStringExtra passthrough data. Empty string when unused.
roleIDStringCharacter/role id.
欄位型別說明
userIDString購買者的 VNGGames 使用者 id。
serverIDString遊戲伺服器 id。
itemIDString在商店設定的商品 id。
appTransIDString你在 App 端的交易 id,用於對帳。
addInfoString額外的透傳資料。未使用時為空字串。
roleIDString角色 id。
字段类型描述
userIDString购买者的 VNGGames 用户 id。
serverIDString游戏服务器 id。
itemIDString在商店配置的商品 id。
appTransIDString你在 App 端的交易 id,用于对账。
addInfoString额外的透传数据。未使用时为空字符串。
roleIDString角色 id。

SocialUserInfo

A social profile returned by the Facebook profile/friends methods.

由 Facebook 個人檔案/好友方法傳回的社群個人檔案。

由 Facebook 资料/好友方法返回的社交资料。

Fields

欄位

字段

FieldTypeDescription
userIDString?VNGGames/Facebook user id.
nameString?Display name.
avatarImageURLString?Profile picture URL.
欄位型別說明
userIDString?VNGGames/Facebook 使用者 id。
nameString?顯示名稱。
avatarImageURLString?個人檔案圖片 URL。
字段类型描述
userIDString?VNGGames/Facebook 用户 id。
nameString?显示名称。
avatarImageURLString?头像图片 URL。

SocialFriendType

Audience filter for Invite Facebook friends (enum). The Type column is each case’s name.

「邀請 Facebook 好友」的對象篩選(列舉)。Type 欄位為各項目的名稱。

“邀请 Facebook 好友”的受众筛选(枚举)。Type 列为各项的名称。

Fields

欄位

字段

FieldTypeDescription
.ALL_USERSALL_USERSAll friends.
.APP_USERSAPP_USERSFriends who already use the app.
.APP_NON_USERSAPP_NON_USERSFriends who don’t use the app.
欄位型別說明
.ALL_USERSALL_USERS所有好友。
.APP_USERSAPP_USERS已在使用此應用程式的好友。
.APP_NON_USERSAPP_NON_USERS尚未使用此應用程式的好友。
字段类型描述
.ALL_USERSALL_USERS所有好友。
.APP_USERSAPP_USERS已在使用该应用的好友。
.APP_NON_USERSAPP_NON_USERS尚未使用该应用的好友。

InviteFriendsSocialType

The invite request passed to Invite Facebook friends. Variant .Facebook(message, friendType):

傳入「邀請 Facebook 好友」的邀請請求。變體 .Facebook(message, friendType)

传入“邀请 Facebook 好友”的邀请请求。变体 .Facebook(message, friendType)

Fields

欄位

字段

FieldTypeDescription
messageStringInvite message shown in the dialog.
friendTypeSocialFriendTypeAudience filter: see SocialFriendType.
欄位型別說明
messageString在對話框中顯示的邀請訊息。
friendTypeSocialFriendType對象篩選: 請參閱 SocialFriendType
字段类型描述
messageString在对话框中显示的邀请消息。
friendTypeSocialFriendType受众筛选: 请参阅 SocialFriendType

GetFriendsSocialType

The friends query passed to Get Facebook friends. Variant .Facebook(offset, count):

傳入「取得 Facebook 好友」的好友查詢。變體 .Facebook(offset, count)

传入“获取 Facebook 好友”的好友查询。变体 .Facebook(offset, count)

Fields

欄位

字段

FieldTypeDescription
offsetIntPaging offset.
countIntNumber of friends to fetch.
欄位型別說明
offsetInt分頁偏移量。
countInt要取得的好友數量。
字段类型描述
offsetInt分页偏移量。
countInt要获取的好友数量。

ShareType

The share request passed to the Facebook / Instagram share methods (sealed class). Pick the variant for your target. Each carries its own fields:

傳入 Facebook/Instagram 分享方法的分享請求(sealed class)。為你的目標選擇對應變體。每個變體各自帶有欄位:

传入 Facebook/Instagram 分享方法的分享请求(sealed class)。为你的目标选择对应变体。每个变体各自带有字段:

Fields

欄位

字段

FieldTypeDescription
.FacebookPhotoShareType.FacebookPhotoShare a photo to Facebook: supply the image as a Uri or a Bitmap.
.FacebookPhoto.titleString?Optional caption/title.
.FacebookPhoto.imageURIUri?Photo to share, as a content Uri (android.net.Uri): primary constructor.
.FacebookPhoto.bitmapBitmap?Photo to share, as a Bitmap (android.graphics.Bitmap): alternate constructor, converted to a Uri internally.
.FacebookLinkShareType.FacebookLinkShare a link to Facebook.
.FacebookLink.titleString?Link title.
.FacebookLink.descriptionString?Link description.
.FacebookLink.redirectLinkString?URL to share.
.FacebookLink.imageURLString?Optional preview image URL.
.InstagramPhotoFeedShareType.InstagramPhotoFeedShare an image to the Instagram feed.
.InstagramPhotoFeed.imageURIUri?Image to share (android.net.Uri).
.InstagramPhotoStoryShareType.InstagramPhotoStoryShare an image to Instagram Stories.
.InstagramPhotoStory.imageURIUri?Image to share (android.net.Uri).
欄位型別說明
.FacebookPhotoShareType.FacebookPhoto分享相片到 Facebook: 以 Uri 或 Bitmap 提供圖片。
.FacebookPhoto.titleString?選填的說明/標題。
.FacebookPhoto.imageURIUri?要分享的相片,以 content Uri(android.net.Uri)表示: 主要建構式。
.FacebookPhoto.bitmapBitmap?要分享的相片,以 Bitmap(android.graphics.Bitmap)表示: 替代建構式。會在內部轉換為 Uri。
.FacebookLinkShareType.FacebookLink分享連結到 Facebook。
.FacebookLink.titleString?連結標題。
.FacebookLink.descriptionString?連結說明。
.FacebookLink.redirectLinkString?要分享的 URL。
.FacebookLink.imageURLString?選填的預覽圖片 URL。
.InstagramPhotoFeedShareType.InstagramPhotoFeed分享圖片到 Instagram 動態。
.InstagramPhotoFeed.imageURIUri?要分享的圖片(android.net.Uri)。
.InstagramPhotoStoryShareType.InstagramPhotoStory分享圖片到 Instagram 限時動態。
.InstagramPhotoStory.imageURIUri?要分享的圖片(android.net.Uri)。
字段类型描述
.FacebookPhotoShareType.FacebookPhoto分享照片到 Facebook: 以 Uri 或 Bitmap 提供图片。
.FacebookPhoto.titleString?可选的说明/标题。
.FacebookPhoto.imageURIUri?要分享的照片,以 content Uri(android.net.Uri)表示: 主构造函数。
.FacebookPhoto.bitmapBitmap?要分享的照片,以 Bitmap(android.graphics.Bitmap)表示: 备用构造函数。会在内部转换为 Uri。
.FacebookLinkShareType.FacebookLink分享链接到 Facebook。
.FacebookLink.titleString?链接标题。
.FacebookLink.descriptionString?链接描述。
.FacebookLink.redirectLinkString?要分享的 URL。
.FacebookLink.imageURLString?可选的预览图片 URL。
.InstagramPhotoFeedShareType.InstagramPhotoFeed分享图片到 Instagram 动态。
.InstagramPhotoFeed.imageURIUri?要分享的图片(android.net.Uri)。
.InstagramPhotoStoryShareType.InstagramPhotoStory分享图片到 Instagram 快拍。
.InstagramPhotoStory.imageURIUri?要分享的图片(android.net.Uri)。

Error Codes

Failures arrive as an error on domain net.vnggames.sdk (PassError), banded by source. Each row is one code: Field = numeric error.code, Type = the symbol. Note: for the mapped auth/payment bands the SDK band number is shown in the message while error.code preserves the upstream server value.

失敗會以網域 net.vnggames.sdk 上的錯誤(PassError)傳回,並依來源分段。每一列代表一個錯誤碼: Field=數值 error.code,Type=該符號。注意:對於已對應的驗證/付款分段,訊息中會顯示 SDK 分段編號,而 error.code 則保留上游伺服器的值。

失败以域为 net.vnggames.sdkPassError)的错误形式返回,按来源分段。每一行是一个错误码: Field = 数值 error.code,Type = 符号。注意:对于经过映射的验证 / 支付段,消息中显示的是 SDK 段号,而 error.code 保留上游服务器的原始值。

Auth: VGA / OAuth (7xxx)

VGA (VNGGames Account) / OAuth login errors, delivered as an error. These back the VGA login flows. iOS/Android differ: both share the 7005 to 7020 OAuth codes, but elsewhere the endpoints diverge: on Android user-cancel is 7002 (USER_CANCEL, the legacy build flavor reports 9003 on its cancel-login path), 7003 is LOGIN_FAILED, and 7021 is account-already-bound (QUICK_LOGIN_ACCOUNT_BOUND). iOS instead uses 7001 for cancel and 7021 for validateAccessTokenNullResult, and defines 7022 至 7027 (null-result and quick-login cases) that Android does not.

VGA(VNGGames Account)/OAuth 登入錯誤,以錯誤傳回。這些支撐 VGA 登入流程。iOS 與 Android 有差異:兩者共用 7005 至 7020 的 OAuth 代碼,但其他端點有所分歧: 在 Android 上,玩家取消為 7002(USER_CANCELlegacy 建置風味在其取消登入路徑回報 9003),7003 為 LOGIN_FAILED,而 7021 為帳號已綁定(QUICK_LOGIN_ACCOUNT_BOUND)。iOS 則以 7001 表示取消、以 7021 表示 validateAccessTokenNullResult,並定義了 Android 沒有的 7022 至 7027(未傳回結果與快速登入的情形)。

VGA(VNGGames Account)/ OAuth 登录错误,以错误形式返回。它们支撑 VGA 登录流程。iOS 与 Android 存在差异:两者共用 7005 至 7020 的 OAuth 代码,但其他端点有所分歧: 在 Android 上,玩家取消为 7002(USER_CANCELlegacy 构建风味在其取消登录路径返回 9003),7003 为 LOGIN_FAILED,而 7021 为账号已绑定(QUICK_LOGIN_ACCOUNT_BOUND)。iOS 则以 7001 表示取消、以 7021 表示 validateAccessTokenNullResult,并定义了 Android 没有的 7022 至 7027(未返回结果与快速登录的情形)。

Codes

錯誤碼

错误码

FieldTypeDescription
7000undefinedUnmapped GGID / OAuth error (fallback).
7001cancelLoginPlayer canceled login.
7005invalidRequestOAuth invalid_request.
7006invalidClientOAuth invalid_client.
7007invalidGrantOAuth invalid_grant.
7008invalidScopeOAuth invalid_scope.
7009unsupportedResponseTypeOAuth unsupported_response_type.
7010unsupportedGrantTypeOAuth unsupported_grant_type.
7011unauthorizedClientOAuth unauthorized_client.
7012unauthorizedCodeOAuth unauthorized_code.
7013unauthorizedTokenOAuth unauthorized_token.
7014expiredAccessTokenAccess token expired.
7015expiredRefreshTokenRefresh token expired.
7016inactiveAccessTokenAccess token inactive.
7017accessDeniedAccess denied.
7018serverErrorOAuth server_error.
7019internalErrorOAuth internal_error.
7020invalidUserCredentialsInvalid user credentials.
7021validateAccessTokenNullResultiOS: token validation returned no result. On Android, 7021 is QUICK_LOGIN_ACCOUNT_BOUND (see the platform note above).
7022refreshAccessTokenNullResultToken refresh returned no result.
7023getProfileNullResultProfile fetch returned no result.
7024authenticateNullResultAuthentication returned no result.
7025quickLoginAccountBoundiOS only: the guest account is already bound to a VGA account. Android maps this case to 7021.
7026quickLoginRequiredBindingBinding is required: the user must bind their account (no skip option).
7027quickLoginTurnOffQuick login is disabled. The standard login options are shown instead.
欄位型別說明
7000undefined未對應的 GGID/OAuth 錯誤(備用)。
7001cancelLogin玩家取消登入。
7005invalidRequestOAuth invalid_request。
7006invalidClientOAuth invalid_client。
7007invalidGrantOAuth invalid_grant。
7008invalidScopeOAuth invalid_scope。
7009unsupportedResponseTypeOAuth unsupported_response_type。
7010unsupportedGrantTypeOAuth unsupported_grant_type。
7011unauthorizedClientOAuth unauthorized_client。
7012unauthorizedCodeOAuth unauthorized_code。
7013unauthorizedTokenOAuth unauthorized_token。
7014expiredAccessToken存取權杖已過期。
7015expiredRefreshToken重新整理權杖已過期。
7016inactiveAccessToken存取權杖未啟用。
7017accessDenied存取遭拒。
7018serverErrorOAuth server_error。
7019internalErrorOAuth internal_error。
7020invalidUserCredentials使用者憑證無效。
7021validateAccessTokenNullResultiOS: 權杖驗證未傳回任何結果。在 Android 上,7021 為 QUICK_LOGIN_ACCOUNT_BOUND(見上方平台說明)。
7022refreshAccessTokenNullResult權杖重新整理未傳回任何結果。
7023getProfileNullResult個人檔案取得未傳回任何結果。
7024authenticateNullResult身分驗證未傳回任何結果。
7025quickLoginAccountBound僅 iOS: 此訪客帳號已綁定到某個 VGA 帳號。Android 將此情形對應為 7021。
7026quickLoginRequiredBinding必須綁定: 使用者必須綁定其帳號(無略過選項)。
7027quickLoginTurnOff快速登入已停用。改為顯示標準登入選項。
字段类型描述
7000undefined未映射的 GGID / OAuth 错误(兜底)。
7001cancelLogin玩家取消了登录。
7005invalidRequestOAuth invalid_request 错误。
7006invalidClientOAuth invalid_client 错误。
7007invalidGrantOAuth invalid_grant 错误。
7008invalidScopeOAuth invalid_scope 错误。
7009unsupportedResponseTypeOAuth unsupported_response_type 错误。
7010unsupportedGrantTypeOAuth unsupported_grant_type 错误。
7011unauthorizedClientOAuth unauthorized_client 错误。
7012unauthorizedCodeOAuth unauthorized_code 错误。
7013unauthorizedTokenOAuth unauthorized_token 错误。
7014expiredAccessToken访问令牌已过期。
7015expiredRefreshToken刷新令牌已过期。
7016inactiveAccessToken访问令牌未激活。
7017accessDenied访问被拒绝。
7018serverErrorOAuth server_error。
7019internalErrorOAuth internal_error。
7020invalidUserCredentials用户凭据无效。
7021validateAccessTokenNullResultiOS: 令牌验证未返回结果。在 Android 上,7021 为 QUICK_LOGIN_ACCOUNT_BOUND(见上方平台说明)。
7022refreshAccessTokenNullResult令牌刷新未返回结果。
7023getProfileNullResult资料获取未返回结果。
7024authenticateNullResult身份验证未返回结果。
7025quickLoginAccountBound仅 iOS: 该访客账号已绑定到某个 VGA 账号。Android 将此情形映射为 7021。
7026quickLoginRequiredBinding必须绑定: 用户必须绑定其账号(无跳过选项)。
7027quickLoginTurnOff快速登录已禁用。改为显示标准登录选项。

Auth: Passport legacy (8xxx)

Passport-legacy login errors. The SDK maps each Passport server return code to an 8xxx value (8000 = unknown fallback). error.code carries the 8xxx band while the original server code is in the message. Type = the source Passport server return code.

Passport legacy 登入錯誤。SDK 會將每個 Passport 伺服器回傳碼對應到一個 8xxx 值(8000=未知備用)。error.code 帶有 8xxx 分段,而原始伺服器碼則在訊息中。Type=來源 Passport 伺服器回傳碼。

Passport 旧版登录错误。SDK 将每个 Passport 服务器返回码映射为一个 8xxx 值(8000 = 未知兜底)。error.code 携带 8xxx 段,而原始服务器码在消息中。Type = 来源 Passport 服务器返回码。

Codes

錯誤碼

错误码

FieldTypeDescription
8000unknownUnknown Passport-legacy login error (fallback).
80011Success (server returned code 1).
8002-500System error: inspect server logs.
8003-404Invalid request (client called the wrong URL).
8004-1Bad signature.
8005-2Bad request parameters.
8006-101Email is already registered.
8007-102Email already in use (guest protection).
8008-103Email does not exist (forgot / reset password).
8009-104UserID is already protected.
8010-105UserID not found (account disabled / deleted).
8011-106Invalid login credentials.
8012-107Invalid login credentials (profile mismatch / null).
8013-108Invalid or expired session.
8014-109Under the minimum age allowed to play.
8015-110Account initialization failed.
8016-111User is not in the early-access allow list.
8017-112Account is locked.
8018-113Account profile is incomplete.
欄位型別說明
8000unknown未知的 Passport legacy 登入錯誤(備用)。
80011成功(伺服器回傳碼 1)。
8002-500系統錯誤: 請檢查伺服器記錄。
8003-404無效的請求(用戶端呼叫了錯誤的 URL)。
8004-1簽章錯誤。
8005-2請求參數錯誤。
8006-101電子郵件已註冊。
8007-102電子郵件已被使用(訪客保護)。
8008-103電子郵件不存在(忘記/重設密碼)。
8009-104UserID 已受保護。
8010-105找不到 UserID(帳號已停用/已刪除)。
8011-106登入憑證無效。
8012-107登入憑證無效(個人檔案不符/為 null)。
8013-108工作階段無效或已過期。
8014-109未達允許遊玩的最低年齡。
8015-110帳號初始化失敗。
8016-111使用者不在搶先體驗的允許清單中。
8017-112帳號已鎖定。
8018-113帳號個人檔案不完整。
字段类型描述
8000unknown未知的 Passport 旧版登录错误(兜底)。
80011成功(服务器返回码 1)。
8002-500系统错误: 请检查服务器日志。
8003-404请求无效(客户端调用了错误的 URL)。
8004-1签名错误。
8005-2请求参数错误。
8006-101邮箱已被注册。
8007-102邮箱已被使用(访客保护)。
8008-103邮箱不存在(忘记 / 重置密码)。
8009-104UserID 已受保护。
8010-105找不到 UserID(账号已禁用 / 删除)。
8011-106登录凭据无效。
8012-107登录凭据无效(资料不匹配 / 为空)。
8013-108会话无效或已过期。
8014-109未达到允许游玩的最低年龄。
8015-110账号初始化失败。
8016-111用户不在抢先体验白名单中。
8017-112账号已被锁定。
8018-113账号资料不完整。

Payment: billing server (6xxx)

Billing-server errors. The SDK maps each payment server return code to a 6xxx value (6000 = unknown fallback). Type = the source payment server code.

帳務伺服器錯誤。SDK 會將每個付款伺服器回傳碼對應到一個 6xxx 值(6000=未知備用)。Type=來源付款伺服器碼。

计费服务器错误。SDK 将每个支付服务器返回码映射为一个 6xxx 值(6000 = 未知兜底)。Type = 来源支付服务器码。

Codes

錯誤碼

错误码

FieldTypeDescription
6000unknownUnknown billing-server error (fallback).
60011Success (server returned code 1).
6002-8System under maintenance (any payment-system error maps here).
6003-70Payment error (uncategorized IAP pay failure).
6004-71Invalid receipt (bad signature or mismatched package / product / order).
6005-72Duplicate receipt (already verified successfully).
6006-73Expired receipt (older than 72 hours).
欄位型別說明
6000unknown未知的帳務伺服器錯誤(備用)。
60011成功(伺服器回傳碼 1)。
6002-8系統維護中(任何付款系統錯誤都對應到此)。
6003-70付款錯誤(未分類的 IAP 付款失敗)。
6004-71收據無效(簽章錯誤或 package/product/order 不符)。
6005-72重複的收據(已成功驗證過)。
6006-73收據已過期(超過 72 小時)。
字段类型描述
6000unknown未知的计费服务器错误(兜底)。
60011成功(服务器返回码 1)。
6002-8系统维护中(任何支付系统错误都映射到此)。
6003-70支付错误(未分类的 IAP 支付失败)。
6004-71收据无效(签名错误或 package / product / order 不匹配)。
6005-72收据重复(已成功验证过)。
6006-73收据已过期(超过 72 小时)。

Payment: store / verification (9xxx)

Store, receipt, and verification errors raised during the purchase flow (9xxx client-side band). iOS and Android differ: both are merged here, so the same code number can carry a different meaning on each platform. Type shows the source symbol(s) (iOS / Android).

在購買流程期間引發的商店、收據與驗證錯誤(9xxx 用戶端分段)。iOS 與 Android 有所不同: 此處合併列出,同一組代碼在不同平台上可能代表不同含義。Type 欄顯示來源符號(iOS/Android)。

在购买流程中引发的商店、收据与验证错误(9xxx 客户端段)。iOS 与 Android 有所不同: 此处合并列出,同一组代码在不同平台上可能代表不同含义。Type 列显示来源符号(iOS / Android)。

Codes

錯誤碼

错误码

FieldTypeDescription
9006paymentInfoInvalid / ITEM_NOT_FOUND_CHECK_ITEMiOS: the purchase info is invalid. Android: product not found on the pre-purchase inventory check.
9007paymentProductNotFound / ITEM_NOT_FOUND_PURCHASE_ITEMProduct id not found.
9008paymentVerificationInProgress / ITEM_IS_VERIFYINGA verification is already in progress.
9009paymentCanceled / PAYMENT_CANCELPlayer canceled the purchase.
9010NOT_SIGN_IN_GOOGLE_PLAYAndroid: the player is not signed in to Google Play.
9011NOT_REGISTER_ITEMAndroid: the item / reward package is not registered.
9012HAS_SUBSCRIPTIONAndroid: the player already owns an active subscription for this item.
9013PRODUCT_IS_PENDINGAndroid: the purchase is pending (not yet completed).
9014PURCHASE_FAILED_WITH_BILLING_ERRORAndroid: purchase failed due to a Google Play billing error.
9015PURCHASE_FAILED_NOT_CONTAIN_PURCHASE_LISTAndroid: purchase failed. The returned purchase list did not contain the item.
9016paymentRetrieveAppleReceiptFailediOS: could not read the App Store receipt.
9017paymentOrderDataInvalidiOS: the order data is invalid.
9049paymentPendingiOS: the purchase is pending approval (deferred / Ask-to-Buy).
欄位型別說明
9006paymentInfoInvalid / ITEM_NOT_FOUND_CHECK_ITEMiOS: 購買資訊無效。Android: 購買前查詢庫存時找不到該商品。
9007paymentProductNotFound / ITEM_NOT_FOUND_PURCHASE_ITEM找不到商品 ID。
9008paymentVerificationInProgress / ITEM_IS_VERIFYING已有一項驗證正在進行中。
9009paymentCanceled / PAYMENT_CANCEL玩家取消了購買。
9010NOT_SIGN_IN_GOOGLE_PLAYAndroid: 尚未登入 Google Play。
9011NOT_REGISTER_ITEMAndroid: 道具/獎勵包未註冊。
9012HAS_SUBSCRIPTIONAndroid: 已擁有此項目的有效訂閱。
9013PRODUCT_IS_PENDINGAndroid: 購買處於待處理狀態(尚未完成)。
9014PURCHASE_FAILED_WITH_BILLING_ERRORAndroid: 因 Google Play 帳務錯誤導致購買失敗。
9015PURCHASE_FAILED_NOT_CONTAIN_PURCHASE_LISTAndroid: 購買失敗。回傳的購買清單未包含該項目。
9016paymentRetrieveAppleReceiptFailediOS: 無法讀取 App Store 收據。
9017paymentOrderDataInvalidiOS: 訂單資料無效。
9049paymentPendingiOS: 購買正等待核准(延遲/需家長同意)。
字段类型描述
9006paymentInfoInvalid / ITEM_NOT_FOUND_CHECK_ITEMiOS: 购买信息无效。Android: 购买前查询库存时找不到该商品。
9007paymentProductNotFound / ITEM_NOT_FOUND_PURCHASE_ITEM找不到商品 id。
9008paymentVerificationInProgress / ITEM_IS_VERIFYING已有一个验证正在进行中。
9009paymentCanceled / PAYMENT_CANCEL玩家取消了购买。
9010NOT_SIGN_IN_GOOGLE_PLAYAndroid: 尚未登录 Google Play。
9011NOT_REGISTER_ITEMAndroid: 道具 / 奖励包未注册。
9012HAS_SUBSCRIPTIONAndroid: 已拥有此项目的有效订阅。
9013PRODUCT_IS_PENDINGAndroid: 购买处于待处理状态(尚未完成)。
9014PURCHASE_FAILED_WITH_BILLING_ERRORAndroid: 因 Google Play 结算错误导致购买失败。
9015PURCHASE_FAILED_NOT_CONTAIN_PURCHASE_LISTAndroid: 购买失败。返回的购买列表未包含该商品。
9016paymentRetrieveAppleReceiptFailediOS: 无法读取 App Store 收据。
9017paymentOrderDataInvalidiOS: 订单数据无效。
9049paymentPendingiOS: 购买正在等待批准(延迟 / 需家长同意)。

Social (9xxx)

Facebook and Instagram profile / share / invite failures.

Facebook 與 Instagram 的個人檔案/分享/邀請失敗。

Facebook 与 Instagram 的资料 / 分享 / 邀请失败。

Codes

錯誤碼

错误码

FieldTypeDescription
9024facebookGetProfileNullResultFacebook profile fetch returned no result.
9026facebookShareEmptyPhotoNo photo supplied to share.
9027facebookAppNotInstalledFacebook app is not installed.
9028facebookShareEmptyLinkNo link supplied to share.
9029facebookInviteFriendTitleAndMessageEmptyInvite title and message are both empty.
9030facebookShareCanceledPlayer canceled the share.
9031facebookInviteFriendCanceledPlayer canceled the invite.
9032instagramAppNotInstalledInstagram app is not installed.
9033instagramPhotoLibraryNotAllowedPhoto-library access not granted.
9034instagramShareEmptyPhotoNo photo supplied to share.
9035facebookUnsupportedFacebook feature not enabled in this build.
9038instagramUnsupportedInstagram feature not enabled in this build.
欄位型別說明
9024facebookGetProfileNullResultFacebook 個人檔案取得未傳回任何結果。
9026facebookShareEmptyPhoto未提供要分享的相片。
9027facebookAppNotInstalled未安裝 Facebook 應用程式。
9028facebookShareEmptyLink未提供要分享的連結。
9029facebookInviteFriendTitleAndMessageEmpty邀請的標題與訊息皆為空。
9030facebookShareCanceled玩家取消了分享。
9031facebookInviteFriendCanceled玩家取消了邀請。
9032instagramAppNotInstalled未安裝 Instagram 應用程式。
9033instagramPhotoLibraryNotAllowed未授予相片庫存取權。
9034instagramShareEmptyPhoto未提供要分享的相片。
9035facebookUnsupported此版本未啟用 Facebook 功能。
9038instagramUnsupported此版本未啟用 Instagram 功能。
字段类型描述
9024facebookGetProfileNullResultFacebook 资料获取未返回结果。
9026facebookShareEmptyPhoto未提供要分享的照片。
9027facebookAppNotInstalled未安装 Facebook 应用。
9028facebookShareEmptyLink未提供要分享的链接。
9029facebookInviteFriendTitleAndMessageEmpty邀请标题和消息均为空。
9030facebookShareCanceled玩家取消了分享。
9031facebookInviteFriendCanceled玩家取消了邀请。
9032instagramAppNotInstalled未安装 Instagram 应用。
9033instagramPhotoLibraryNotAllowed未授予相册访问权限。
9034instagramShareEmptyPhoto未提供要分享的照片。
9035facebookUnsupported此构建版本未启用 Facebook 功能。
9038instagramUnsupported此构建版本未启用 Instagram 功能。

General & availability (9xxx)

Cross-cutting client errors any flow can surface, plus feature-availability sentinels. Customer support surfaces an error with the string code invalid_payload. (Reserved/unused: 9004, and 9010 to 9015.)

任何流程都可能出現的橫切用戶端錯誤,以及功能可用性的哨符值。客戶支援會以字串碼 invalid_payload 呈現一個錯誤。(保留/未使用:9004、9010 至 9015)

任何流程都可能暴露的横切客户端错误,以及功能可用性哨兵值。客户支持会以字符串码 invalid_payload 暴露一个错误。(保留 / 未使用:9004、9010 至 9015)

Codes

錯誤碼

错误码

FieldTypeDescription
9000undefinedUndefined / unknown error.
9001networkFailedNetwork request failed (retryable).
9002wrongDataFormatMalformed response data.
9003cancelLoginLogin canceled (SDK band).
9005googleRefreshTokenFailedGoogle token refresh failed.
9018appleCredentialNotFoundInAuthorizationResultApple authorization returned no credential.
9019googleConfigNotFoundGoogle config missing.
9020facebookConfigNotFoundFacebook config missing.
9021appleTwoAuthenticationErrorSign in with Apple 2FA error.
9022appleCancelErrorPlayer canceled Sign in with Apple.
9023appleOtherErrorOther Sign in with Apple error.
9025appleCachedCredentialNotFoundNo cached Apple credential.
9036googleUnsupportedGoogle login not enabled in this build.
9037vgaUnsupportedVGA login not enabled in this build.
9047firebaseUnsupportedFirebase not enabled in this build.
欄位型別說明
9000undefined未定義/未知的錯誤。
9001networkFailed網路請求失敗(可重試)。
9002wrongDataFormat回應資料格式錯誤。
9003cancelLogin登入已取消(SDK 分段)。
9005googleRefreshTokenFailedGoogle 權杖重新整理失敗。
9018appleCredentialNotFoundInAuthorizationResultApple 授權未傳回任何憑證。
9019googleConfigNotFound缺少 Google 設定。
9020facebookConfigNotFound缺少 Facebook 設定。
9021appleTwoAuthenticationError使用 Apple 登入的兩階段驗證錯誤。
9022appleCancelError玩家取消了使用 Apple 登入。
9023appleOtherError其他使用 Apple 登入的錯誤。
9025appleCachedCredentialNotFound沒有快取的 Apple 憑證。
9036googleUnsupported此版本未啟用 Google 登入。
9037vgaUnsupported此版本未啟用 VGA 登入。
9047firebaseUnsupported此版本未啟用 Firebase。
字段类型描述
9000undefined未定义 / 未知错误。
9001networkFailed网络请求失败(可重试)。
9002wrongDataFormat响应数据格式错误。
9003cancelLogin登录已取消(SDK 段)。
9005googleRefreshTokenFailedGoogle 令牌刷新失败。
9018appleCredentialNotFoundInAuthorizationResultApple 授权未返回凭据。
9019googleConfigNotFound缺少 Google 配置。
9020facebookConfigNotFound缺少 Facebook 配置。
9021appleTwoAuthenticationErrorSign in with Apple 双重验证(2FA)错误。
9022appleCancelError玩家取消了 Sign in with Apple。
9023appleOtherError其他 Sign in with Apple 错误。
9025appleCachedCredentialNotFound没有缓存的 Apple 凭据。
9036googleUnsupported此构建版本未启用 Google 登录。
9037vgaUnsupported此构建版本未启用 VGA 登录。
9047firebaseUnsupported此构建版本未启用 Firebase。