《鸿蒙开发-答案之书》获取aaid

46 阅读1分钟
《鸿蒙开发-答案之书》获取aaid

鸿蒙的获取aaid很简单,也不用权限。但是它卸载重装后会变,其他的没毛病,可以作为唯一值

直接上代码:

 // 获取AAID
    try {
      CommonConstants.AAID = await AAID.getAAID();
    } catch (err) {
      let e: BusinessError = err as BusinessError;
      hilog.error(0x0000, 'testTag', 'Get AAID catch error: %{public}d %{public}s', e.code, e.message);
    }

有鸿蒙开发bug或者需求的可私信我,我每天都看私信的