XuqmGroup-AndroidSDK/sdk-license
XuqmGroup 3fe411738d docs(sdk): 更新跨平台SDK设计规范至v1.1版本
- 更新版本号至v1.1,状态调整为Android已落地
- 添加私有化与公有平台完全独立的原则说明
- 增加Android配置文件路径规范
- 修改platformUrl为可选参数,默认使用内置公有平台地址
- 添加awaitInitialization和retryInitialization方法
- 调整API响应格式,统一返回data结构
- 优化各子SDK配置流程和错误处理机制
- 更新ImSDK登录逻辑,支持userSig为空时跳过连接
- 添加platformType和platformConfig属性
- 标记login/logout方法为已废弃,合并至setUserInfo
- 修改PushSDK方法签名,将Promise改为void
- 添加PushSDK.currentRegistration和detectVendor方法
- 更新Android Kotlin代码示例和完整示例
- 重构服务端接口要求章节,明确各子SDK独立配置接口
- 更新测试代码,替换login/logout为setUserInfo
- 调整UI组件中的推送设置调用方式
2026-06-15 15:51:58 +08:00
..
src/main docs(sdk): 更新跨平台SDK设计规范至v1.1版本 2026-06-15 15:51:58 +08:00
build.gradle.kts build: 各 SDK 模块独立版本,publish.gradle 改用 project.version 2026-05-21 16:48:10 +08:00
consumer-rules.pro Add Android license SDK 2026-05-15 21:00:24 +08:00
README.md Use appKey in license SDK requests 2026-05-15 21:42:27 +08:00

Xuqm License SDK

Android SDK for device license registration and verification.

Features

  • Stable Device ID: Uses ANDROID_ID (stable per app signing key + device + user), with UUID fallback
  • Token Caching: Caches valid status for configurable window (default 10 min) to reduce network calls
  • Auto Recovery: Automatically re-registers when token is invalid or revoked
  • Offline Support: Returns cached OK status when network is unavailable
  • Encrypted License File: Reads assets/xuqm/license.xuqm; the file does not expose appKey or server URL as readable text
  • AppKey Change Detection: Automatically clears old data when decrypted appKey changes

Integration

dependencies {
    implementation("com.xuqm:sdk-license:0.1.0-SNAPSHOT")
}

Usage

License File

Download the encrypted License file from the tenant platform and place it at:

app/src/main/assets/xuqm/license.xuqm

The SDK also accepts a tenant-platform downloaded file such as app/src/main/assets/xuqm/MyApp.xuqmlicense.

No explicit initialization code is required.

Check License

LicenseSDK.checkLicense { isValid ->
    if (isValid) {
        // allow app usage
    } else {
        // block app usage or show warning
    }
}

Optional user metadata can be uploaded during the same check. All fields are optional.

LicenseSDK.checkLicense(
    userInfo = LicenseUserInfo(
        userId = "u_10001",
        name = "张三",
        email = "zhangsan@example.com",
        phone = "13800000000",
    ),
) { isValid ->
    // allow or block app usage
}

Get Status (no network)

val status = LicenseSDK.getStatus() // OK, DENIED, or UNKNOWN

Re-register (force)

lifecycleScope.launch {
    val result = LicenseSDK.reRegister()
}

Get Device ID

val deviceId = LicenseSDK.getDeviceId()

Configuration

Parameter Default Description
appKey from encrypted file AppKey from tenant platform
deviceName ${MANUFACTURER} ${MODEL} Device display name
baseUrl https://auth.dev.xuqinmin.com/ License server base URL

Data Storage

All data (device ID, token, status) is stored in EncryptedSharedPreferences with AES-256 encryption.