init static method

  1. @Deprecated("使用 initWithoutStart() 和 start() 方法替代")
void init(
  1. String appId, {
  2. bool isDebug = true,
  3. int gdpr = -1,
  4. int coppa = -1,
  5. int ccpa = -1,
  6. int age = 0,
  7. ZJCustomController? customController,
  8. dynamic initListener(
    1. ZJEvent ret
    )?,
})

初始化SDK

Implementation

@Deprecated("使用 initWithoutStart() 和 start() 方法替代")
static void init(

    /// 应用ID
    String appId,
    {
    /// 控制日志打印
    bool isDebug = true,

    /// gdpr状态,-1为未知,0为用户未授权,1为用户授权
    int gdpr = -1,

    /// coppa状态,-1为未知,0为成人,1为儿童
    int coppa = -1,

    /// ccpa状态,-1为未知,0为允许出售,1为不允许出售
    int ccpa = -1,

    /// 用户年龄,默认为0
    int age = 0,

    /// 隐私权限控制
    ZJCustomController? customController,

    /// 初始化回调
    /// [ret.event] {ZJEventAction.initSuccess | ZJEventAction.initFailed},初始化失败时,需要解析ret.code等信息排查
    /// [ret.code] 错误码
    /// [ret.msg] 错误描述
    Function(ZJEvent ret)? initListener}) {
  ZJSdkMessageChannel.init(initListener);
  _sdkMethodChannel.invokeMethod("init", {
    "appId": appId,
    "isDebug": isDebug,
    "gdpr": gdpr,
    "coppa": coppa,
    "ccpa": ccpa,
    "age": age,
    "customController": customController?.toMap(),
  });
}