跳到主要内容

DeviceScan 对象

要使用 DeviceScanSDK,需要实例化 DeviceScan 类。该实例接收 currentContext,并可以使用 token/session、环境和回调(notifier)进行配置。

重要提示!

从版本 5.0.0 开始,认证系统已更新为使用临时 token 替代 mobileToken

版本 5.0.0+

参数功能必需
currentContext应用程序上下文,用于访问所需数据。是。
token(通过 .setToken(this.token))认证令牌,标识所收集数据来自您的应用程序。通过向 Device Scan API 发送请求获取令牌。是。
sessionId(通过 .setSessionId(this.sessionId))所收集数据所属会话的标识符。是。
notifier(通过 .setNotifier(this.deviceScanNotifier))DeviceScanNotifier 实例。作为回调,返回发送状态(成功或失败)。否。
sandbox(通过 .setSandboxEnvironment())将库配置为向 sandbox 环境发送数据。如果未配置,请求将发送至 production否。

默认环境:如果未调用 setSandboxEnvironment(),则发送至 production

旧版本(4.x 及以下)

参数功能必需
currentContext应用程序上下文,用于访问所需数据。是。
mobileToken(通过 .setMobileToken(this.mobileToken))标识所收集数据来自您的应用程序的客户端密钥。如果您尚未收到 mobile-token,请联系支持团队:suporte.caas@qitech.com.br是。
sessionId(通过 .setSessionId(this.sessionId))所收集数据所属会话的标识符。是。
notifier(通过 .setNotifier(this.deviceScanNotifier))DeviceScanNotifier 实例。作为回调,返回发送状态(成功或失败)。否。
sandbox(通过 .setSandboxEnvironment())将库配置为向 sandbox 环境发送数据。如果未配置,请求将发送至 production否。

快速摘要(迁移)

  • 5.0.0+:使用临时 tokensetToken(this.token)
  • < 5.0.0:使用 mobileTokensetMobileToken(this.mobileToken)
  • 两者均需:currentContextsessionId 为必填项。notifiersandbox 为可选项。