[英]How can i get the Wi-fi Mac Address of the device that are connected to my hotspot and save it to my database?
我正在開發一個android應用程序,我想在連接到移動熱點時獲取設備的Wi-Fi mac地址並將其保存到我的數據庫中。
我怎樣才能做到這一點?
在Android 6.0更改之后
為了向用戶提供更好的數據保護,從此版本開始,Android刪除使用Wi-Fi和Bluetooth API對應用程序對設備本地硬件標識符的編程訪問。 WifiInfo.getMacAddress()和BluetoothAdapter.getAddress()方法現在返回常數值02:00:00:00:00:00。
在Android 6.0更改之前,可以通過WifiManager接收MAC地址。
WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = manager.getConnectionInfo();
String address = info.getMacAddress();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.