Hi everyone, I am using the ionic native Diagnostic to detect whether the APP connecting wifi, it works fine.
However, if I turn off the wifi within the page, the wifi status can’t be changed immediately, it requires me to revisit the page. May I know is there any method to do in page refresh wifi status?
My code is as below for reference. Many thanks.
ts
import { Diagnostic } from 'ionic-native'; public wifiSupported:boolean; platform.ready().then(() => { Diagnostic.isWifiAvailable().then((res) => { console.log('diagnostic result', res); this.wifiSupported = res; }).catch((err) => { console.log('got an error using diagnostic'); console.dir(err); }); });
.html
<button *ngIf="wifiSupported">Wifi Available</button>