unity 读取手机电量
来源:互联网 发布:电脑卸载软件推荐 编辑:程序博客网 时间:2024/05/16 02:03
using UnityEngine;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Text;using System;using UnityEngine.iOS;public enum NetworkWorkSituation{ NotReachable, ReachableViaCarrierDataNetwork, ReachableViaLoaclAreaNetwork,}public class MobilePhone : MonoBehaviour{ public static NetworkWorkSituation type; public static NetworkWorkSituation GetNetworkState() { //断网 if (Application.internetReachability == NetworkReachability.NotReachable) { type = NetworkWorkSituation.NotReachable; } //手机网络 else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) { type = NetworkWorkSituation.ReachableViaCarrierDataNetwork; } //wifi else if(Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { type = NetworkWorkSituation.ReachableViaLoaclAreaNetwork; } return type; }#if UNITY_ANDROID public static int GetBatteryLevel() { 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 -1; }#endif public static float GetMobilePowerPersent() { #if UNITY_IPHONE return GetiOSBatteryLevel();#elif UNITY_ANDROID return GetBatteryLevel()#else return 0;#endif }}
阅读全文
0 0
- unity 读取手机电量
- unity获取手机电量信息
- Unity获取当前手机电量的方法
- Unity获取手机电量 网络和时间
- 手机电量
- Unity&Android之二:获取手机电量信息、网络状况
- unity 获取电量;
- 获取手机电量
- Android手机电量
- Android 获取手机电量
- 手机显示电量原理
- 获取手机电量百分比
- Android获取手机电量
- android获取手机电量
- unity如何获取安卓手机的时间电量网络信息
- 【Unity】Unity3D 移获取手机电量与wifi信号的获取
- android获得手机的电量
- 打印显示手机剩余电量
- java基础学习之——子类重写(覆盖)父类的方法必须满足的条件
- 安装被策略阻止
- Entity Framework Core 2.0 中使用LIKE 操作符
- <28>—— Implement strStr()
- su-, su:认证失败
- unity 读取手机电量
- Android GLSurfaceView.Renderer 类 onDrawFrame 方法的刷新机制
- Java基础之集合框架所对应的数据结构
- 小学期 修剪草坪
- CodeForces Gym 101190简要题解
- PAT (Advanced) 1004. Counting Leaves (30)
- LA4329:Ping pong(树状数组入门)
- 【java字符串格式化】String.format()使用方法
- Python实现套接字(Socket)的客户端(Client)