第一张我是从其他APP里面看到的权限信息,看到里面有开启无线网络的权限。
第二张是我的APP但是无法开启。,
在官网上查过,用Network,的组件,但是试过那些代码都不行...求老师解答。
import { Network } from 'ionic-native';
let disconnectSubscription = Network.onDisconnect().subscribe(() => {
console.log('network was disconnected :-(');
});
disconnectSubscription.unsubscribe();
// watch network for a connection
let connectSubscription = Network.onConnect().subscribe(() => {
console.log('network connected!');
// We just got a connection but we need to wait briefly
// before we determine the connection type. Might need to wait
// prior to doing any api requests as well.
setTimeout(() => {
if (Network.connection === 'wifi') {
console.log('we got a wifi connection, woohoo!');
}
}, 3000);
});
// stop connect watch
connectSubscription.unsubscribe();
}