获取的WiFi点设备的MAC地址连接到离子2

问题描述:

我不知道我怎么能拿设备连接到离子2.获取的WiFi点设备的MAC地址连接到离子2

WiFi网络点的MAC地址我知道有一个类似回答here,但它是为离子1.

好吧,所以为了得到这个信息,你需要使用一个非本地插件的离子。我试过这个one。然后在我的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)); 
    }); 

在控制台,你会看到无线网络信息的MAC等enter image description here