PottingMobileUtilsiOS.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. using UnityEngine;
  5. #if UNITY_IOS
  6. public class PottingMobileUtilsiOS : PottingMobileUtilsBase
  7. {
  8. [DllImport("__Internal")]
  9. private static extern string GetCurrentNetworkState();
  10. /// 获取设备IDFA
  11. [DllImport("__Internal")]
  12. private static extern string GetDeviceIDFA();
  13. /// 获取设备IDFV
  14. [DllImport("__Internal")]
  15. private static extern string GetDeviceIDFV();
  16. [DllImport("__Internal")]
  17. /// 是否是异形屏
  18. private static extern bool IsAbnormityScreen();
  19. [DllImport("__Internal")]
  20. /// 获取设备系统版本
  21. private static extern string GetDeviceSystomVersion();
  22. //获取网络商名称
  23. [DllImport("__Internal")]
  24. private static extern string GetCarrierName();
  25. [DllImport("__Internal")]
  26. private static extern string GetDeviceVersion();
  27. [DllImport("__Internal")]
  28. private static extern string GetDeviceInfo();
  29. /// <summary>
  30. /// 获取网络状态
  31. /// </summary>
  32. public new static string _GetNetworkType()
  33. {
  34. return GetCurrentNetworkState();
  35. }
  36. /// <summary>
  37. /// 获取设备id
  38. /// </summary>
  39. /// <returns></returns>
  40. public new static string _GetDeviceId()
  41. {
  42. return GetDeviceIDFA();
  43. }
  44. /// <summary>
  45. /// 获取iOS设备的IDFV,同一发布厂商在同设备下相同,卸载只不会改变
  46. /// </summary>
  47. /// <returns></returns>
  48. public new static string _iosGetDeviceIDFV()
  49. {
  50. return GetDeviceIDFA();
  51. }
  52. /// <summary>
  53. /// 判断是否挖孔屏
  54. /// </summary>
  55. /// <returns></returns>
  56. public new static bool _HasNotchScreen()
  57. {
  58. return IsAbnormityScreen();
  59. }
  60. /// <summary>
  61. /// 获取系统版本
  62. /// </summary>
  63. /// <returns></returns>
  64. public new static string _GetSystemVersion()
  65. {
  66. return GetDeviceSystomVersion();
  67. }
  68. public new static string _GetSimOperatorByMnc()
  69. {
  70. return GetCarrierName();
  71. }
  72. /// <summary>
  73. /// 获取手机型号
  74. /// </summary>
  75. /// <returns></returns>
  76. public new static string _GetModel()
  77. {
  78. return GetDeviceVersion();
  79. }
  80. /// <summary>
  81. /// 获取手机信息字典
  82. /// </summary>
  83. /// <returns></returns>
  84. public new static string _GetDeviceInfo()
  85. {
  86. return GetDeviceInfo();
  87. }
  88. }
  89. #endif