1# @ohos.identifier.oaid (广告标识服务)(系统接口)
2
3
4本模块提供开放匿名设备标识符(Open Anonymous Device Identifier, OAID,以下简称OAID)的获取和重置能力。
5
6
7> **说明:**
8> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
9> 使用获取开放匿名设备标识符接口,需[向用户申请授权](../../security/AccessToken/request-user-authorization.md):ohos.permission.APP_TRACKING_CONSENT
10> 当前页面仅包含本模块的系统接口,其他公开接口参见[@ohos.identifier.oaid (广告标识服务)](js-apis-oaid.md)
11
12
13## 导入模块
14
15```
16import identifier from '@ohos.identifier.oaid';
17```
18
19## identifier.resetOAID
20
21resetOAID(): void
22
23重置开放匿名设备标识符(Open Anonymous Device Identifier, OAID)。
24
25**系统接口:** 此接口为系统接口。
26
27**系统能力:** SystemCapability.Advertising.OAID
28
29**错误码:**
30
31以下错误码的详细介绍请参见[广告标识服务错误码参考](errorcode-oaid.md)。
32
33| 错误码ID | 错误信息 |
34| -------- | -------- |
35| 202      | Permission verification failed. A non-system application calls a system API. |
36| 17300001 | System internal error. |
37| 17300002 | Not in the trust list. |
38
39**示例:**
40```
41import identifier from '@ohos.identifier.oaid';
42import hilog from '@ohos.hilog';
43
44try {
45  identifier.resetOAID();
46} catch (err) {
47  hilog.error(0x0000, 'testTag', '%{public}s', `reset oaid catch error: ${err.code} ${err.message}`);
48}
49```
50