= Build.VERSio" /> = Build.VERSio" />
获取Mac地址: public static String GetMAC(Context context) { String Mac = ""; if (Build.VERSION.SDK_INT >= Build.VERSio
获取Mac地址:
public static String GetMAC(Context context) { String Mac = ""; if (Build.VERSION.SDK_INT >= Build.VERSioN_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.N) { Mac = getMacAddress(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Mac = getMacFromHardware(); } return Mac;}private static String getMacAddress() { String Mac = null; String str = ""; try { Process pp = Runtime.getRuntime().exec("cat/sys/class/net/wlan0/address"); InputStreamReader ir = new InputStreamReader(pp.getInputStream()); LineNumberReader input = new LineNumberReader(ir); while (null != str) { str = input.readLine(); if (str != null) { Mac = str.trim();//去空格 break; }
来源地址:https://blog.csdn.net/wxx314165038/article/details/131305199
--结束END--
本文标题: Android获取mac地址、OA地址和外网IP地址
本文链接: https://www.lsjlt.com/news/397098.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0