Please anyone tell me how we can find mac address in ionic 4 and use that mac address as a string in a var. Thank you
Check this plugin
declare var WifiInfo
then on app constructor after the platform ready I use it like this.
this.platform.ready()
.then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things
// you might need.
this.statusBar.styleDefault();
this.splashScreen.hide();
// console log an object with wifi info
WifiInfo.getWifiInfo(wifiInfo => console.log(wifiInfo),
wifiError => console.log(wifiError));
});
This code return that.
{
"MacAddress" : "xx:xx:xx:xx:xx:xx",
"BSSID" : "xx:xx:xx:xx:xx:xx",
"HiddenSSID" : false,
"IpAddress" : "x.x.x.x",
"LinkSpeed" : 72,
"NetworkId" : 5,
"Rssi" : -40,
"SSID" : "\"xxx_xxx\""
}
Thank you so much this works for me
IOS:
Select Settings > General > About.
A Wi-Fi Address displays. This is your device’s MAC address.
Android:
In most cases, you can follow this procedure to locate your MAC address:
Select Settings > About Device > Status.
A WiFi Address or WiFi MAC Address displays. This is your device’s MAC address.