Hi,
I want to use wifi info plugin ( https://github.com/hoerresb/WifiWizard) . Do you know where could I find a complete example?
Thanks
Hi,
I want to use wifi info plugin ( https://github.com/hoerresb/WifiWizard) . Do you know where could I find a complete example?
Thanks
Have you solved the problem yet?
hi friend did you found an exemple ?
Yo! I used this plugin with Ionic 3 worked like a charm.
I don’t know if this is best practice but check out this solution.
First in src/app create file global.ts with this content:
declare let WifiWizard: WifiWizard;
Then in src/app/main.ts add import:
import './global';
Then in src/ create file wifiwizard.d.ts this would be our typing for this plugin. The content of typings:
interface Navigator {
wifiwizard: WifiWizard
}
interface WifiWizard {
formatWifiConfig(
SSID: string,
password: string,
algorithm: string
): wifiConfig;
formatWPAConfig(
SSID: string,
password: string,
): void;
formatWifiString(
ssid: string
): void;
addNetwork(
wifi: object,
win: () => void,
fail: () => void
): void;
removeNetwork(
SSID: string,
win: () => void,
fail: () => void
)
connectNetwork(
SSID: string,
win: () => void,
fail: () => void
): void;
disconnectNetwork(
SSID: string,
win: () => void,
fail: () => void
): void;
listNetworks(
win: () => void,
fail: () => void
): void;
getCurrentSSID(
win: () => void,
fail: () => void
): void;
setWifiEnabled(
enabled: boolean,
win: () => void,
fail: () => void
): void;
}
interface wifiConfig {
}
then us it in your code like this:
export class SomeClass {
constructor() {}
wifienabled() {
let enabled;
WifiWizard.isWifiEnabled(
scc => {
enabled = scc;
console.log('isWifiEnabled scc', scc)
},
err => console.log('isWifiEnabled err', err)
);
if (!enabled) {
WifiWizard.setWifiEnabled(
true,
scc => console.log('setWifiEnabled scc', scc),
err => console.log('setWifiEnabled err', err)
)
}
}
addwifi() {
let config = WifiWizard.formatWifiConfig('MyNetworkName', 'mynetworkpassword', 'WPA');
console.log('addwifi config', config);
WifiWizard.addNetwork(
config,
scc => console.log('addWifi scc', scc),
err => console.log('addWifi err', err)
);
}
listwifi() {
WifiWizard.listNetworks(
scc => console.log('listNetworks scc', scc),
err => console.log('listNetworks err', err)
);
}
}
add come click events and try it out, look into console
Hope this helps, cheers
pls refer this website.I hope it will helpful
Hello, do you have a downloadable sample project using WifiWizard Cordova plugin ?