ATTAuth.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // using System;
  2. // using UnityEngine;
  3. //
  4. // namespace GFGGame.Launcher
  5. // {
  6. // public class ATTAuth : MonoBehaviour
  7. // {
  8. // [System.Runtime.InteropServices.DllImport("__Internal")]
  9. // private static extern void _RequestTrackingAuthorizationWithCompletionHandler();
  10. //
  11. // [System.Runtime.InteropServices.DllImport("__Internal")]
  12. // private static extern int _GetAppTrackingAuthorizationStatus();
  13. //
  14. // private static Action<int> getAuthorizationStatusAction;
  15. //
  16. // /// <summary>
  17. // /// 请求ATT授权窗口
  18. // /// </summary>
  19. // /// <param name="getResult"></param>
  20. // public static void RequestTrackingAuthorizationWithCompletionHandler(Action<int> getResult)
  21. // {
  22. // //-1:"ios版本低于14"
  23. // //0: "ATT 授权状态待定";
  24. // //1: "ATT 授权状态受限";
  25. // //2: "ATT 已拒绝";
  26. // //3: "ATT 已授权";
  27. // Debug.Log("RequestTrackingAuthorizationWithCompletionHandler");
  28. // getAuthorizationStatusAction = getResult;
  29. // _RequestTrackingAuthorizationWithCompletionHandler();
  30. // }
  31. //
  32. // /// <summary>
  33. // /// 获取当前ATT授权状态
  34. // /// </summary>
  35. // /// <returns></returns>
  36. // public static int GetAppTrackingAuthorizationStatus()
  37. // {
  38. // return _GetAppTrackingAuthorizationStatus();
  39. // }
  40. //
  41. // public void GetAuthorizationStatus(string status)
  42. // {
  43. // getAuthorizationStatusAction?.Invoke(int.Parse(status));
  44. // }
  45. //
  46. // }
  47. // }
  48. //