Version: 2023.1

Application.RequestAdvertisingIdentifierAsync

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

参数

delegateMethod 委托方法。

返回

bool Returns true if successful, and false for platforms which do not support Advertising Identifiers. In this case, the delegate method is not invoked.

描述

Request an advertising ID for iOS and UWP.

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); } ); } }