2017-06-20 40 views

回答

2

好吧,所以爲了得到這個信息,你需要使用一個非本地插件的離子。我試過這個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

相關問題