I have learned that since the Android 6.0:
Android removes programmatic access to the device’s local hardware
identifier for apps using the Wi-Fi and Bluetooth APIs. The
WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress()
methods now return a constant value of 02:00:00:00:00:00。
But,what I confused is when my targetSdkVersion is lower than 23 it still returns the constant in android 6.0 device. In my opinion, I think it should return an unique hardware identifier because of the Application forward compatibility. Whay did not system enable any compatibility behaviors ? This is my uses-sdk:
android:minSdkVersion="8"
android:targetSdkVersion="22"
This is my method:
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
String macAddress = wifiInfo.getMacAddress();
Thanks.Forgive my broken English.
Why did not system enable any compatibility behaviors ?
For sake of data protection, we are not entitled to this kind of forward compatibility. Your app still runs , right? So it is forward compatible. but security loopholes must be addressed even if it hurts someone's legitimate purpose.
And sending a constant value 02:00:00:00:00:00 is a compatibility behavior otherwise they would have just return null value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With