安卓获取设备信息

游客

标题:安卓获取设备信息
正文:
安卓获取设备信息 import java.net.NetworkInterface;import java.net.SocketException;import java.util.Enumeration; import android.app.Activity;import android.app.Application;import android.content.Intent;import android.content.IntentFilter;import android.provider.Settings;import android.telephony.TelephonyManager;import android.util.Log; public class MiddleCS{ public static int GetAndroidBatteryLevel(Activity unityActivity) { IntentFilter iFilter = new IntentFilter(&quot;android.intent.action.BATTERY_CHANGED&quot;); Intent intent = unityActivity.getApplication().registerReceiver(null, iFilter); int rawLevel = intent.getIntExtra(&quot;level&quot;, -1); int scale = intent.getIntExtra(&quot;scale&quot;, -1); int status = intent.getIntExtra(&quot;status&quot;, 0); int level = -1; if ((rawLevel &gt; 0) &amp;&amp; (scale &gt; 0)) { level = rawLevel
[<<][[1]][2][3][>>]

查看评论(0)
发表评论

首页