我想知道如何在ionic 2中获取设备连接的wifi网络点的mac地址。
我知道有一个类似的答案在这里,但它是离子1。
好吧,为了获得该信息,您将需要为离子使用“非本地”插件。我想这一个。然后在我的app.component.ts中,我在组件本身之前声明了一个新变量。
declare var WifiInfo
然后在平台准备好后,在我的应用程序构造函数中像这样使用它。
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));
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句