1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file Provides the capability to manage OAID 18 * @kit AdsKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22 23/** 24 * Provides the capability to manage OAID. 25 * @namespace identifier 26 * @syscap SystemCapability.Advertising.OAID 27 * @since 10 28 */ 29declare namespace identifier { 30 /** 31 * Obtain the OAID with callback. 32 * Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, otherwise the obtained OAID is 00000000-0000-0000-0000-000000000000. 33 * @permission ohos.permission.APP_TRACKING_CONSENT 34 * @param { AsyncCallback<string> } callback - The callback to get the OAID. 35 * @throws { BusinessError } 17300001 - System internal error. 36 * @syscap SystemCapability.Advertising.OAID 37 * @since 10 38 */ 39 function getOAID(callback: AsyncCallback<string>): void; 40 41 /** 42 * Obtain the OAID with promise. 43 * Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, otherwise the obtained OAID is 00000000-0000-0000-0000-000000000000. 44 * @permission ohos.permission.APP_TRACKING_CONSENT 45 * @returns { Promise<string> } promise - Returns the OAID. 46 * @throws { BusinessError } 17300001 - System internal error. 47 * @syscap SystemCapability.Advertising.OAID 48 * @since 10 49 */ 50 function getOAID(): Promise<string>; 51 52 /** 53 * Reset the OAID. 54 * A new OAID will be generated after reset. 55 * @throws { BusinessError } 17300001 - System internal error. 56 * @syscap SystemCapability.Advertising.OAID 57 * @systemapi 58 * @since 10 59 */ 60 /** 61 * Reset the OAID. 62 * A new OAID will be generated after reset. 63 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 64 * @throws { BusinessError } 17300001 - System internal error. 65 * @throws { BusinessError } 17300002 - Not in the trust list. 66 * @syscap SystemCapability.Advertising.OAID 67 * @systemapi 68 * @since 12 69 */ 70 function resetOAID(): void; 71} 72export default identifier; 73 74