Hello, I’m trying to use the Ionic Native Network Interface plugin but keep failing to get the wifi ip address and I’m not sure why. I would love for someone to point me in the right direction if possible.
Here’s what I have currently:
import { NetworkInterface } from '@ionic-native/network-interface/ngx';
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
@Injectable()
export class MyService {
constructor( private networkInterface: NetworkInterface, private platform: Platform ) {
platform.ready().then(() => {
this.networkInterface.getWiFiIPAddress()
.then(address => console.log('IP: ' + address.ip + ', Subnet: ' + address.subnet))
.catch(error => console.log('ERROR: ' + error));
});
}
}