Version: 2021.3

Application.RequestAdvertisingIdentifierAsync

切换到手册
public static bool RequestAdvertisingIdentifierAsync (Application.AdvertisingIdentifierCallback delegateMethod);

参数

delegateMethod 委托方法。

返回

bool 如果成功则返回 true,对于不支持广告标识符的平台则返回 false。在这种情况下,不会调用委托方法。

描述

Request advertising ID for iOS and Windows Store.

using System;
using UnityEngine;

public class SampleBehaviour : MonoBehaviour { public void Start() { Application.RequestAdvertisingIdentifierAsync( (string advertisingId, bool trackingEnabled, string error) => { Debug.Log("advertisingId " + advertisingId + " " + trackingEnabled + " " + error); } ); } }