using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [Obsolete("Please Use Module_Device")] public class DeviceInfo { /// /// 设备型号 /// /// public static string MODEL { get{ if(Application.platform == RuntimePlatform.Android) { AndroidJavaClass os = new AndroidJavaClass("android.os.Build"); return os.GetStatic("MODEL"); } return "Standalone"; } } /// /// SN号 /// public static string SN { get { if(Application.platform == RuntimePlatform.Android) { AndroidJavaClass os = new AndroidJavaClass("android.os.Build"); return os.GetStatic("SERIAL"); } return "Null"; } } /// /// Release_Vesion /// public static string RELEASE_VERSION { get { if(Application.platform == RuntimePlatform.Android) { AndroidJavaClass os = new AndroidJavaClass("android.os.Build$VERSION"); return os.GetStatic("RELEASE"); } return "Null"; } } /// /// BatteryLevel /// public static int BatteryLevel { get { if (Application.platform == RuntimePlatform.Android) { try { string CapacityString = System.IO.File.ReadAllText("/sys/class/power_supply/battery/capacity"); return int.Parse(CapacityString); } catch (Exception e) { Debug.Log("Failed to read battery power; " + e.Message); } } return 60; } } }