-1

How i can get mac address by using nativescript for android device?

I tried get mac like at this question Get mac address and ip in Nativescript

Also, i tried:

let mac = java.net.NetworkInterface.getHardwareAddress();

And i get error

TypeError: test.getHardwareAddress is not a function

But, if i print console.log(java.net.NetworkInterface) at the log we will see getHardwareAddress

Thank you :)

1 Answers1

0

Manoj's answer worked for me, but since Android 6.0:

To provide users with greater data protection, starting in this release, 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.

TomG
  • 538
  • 4
  • 20