Reputation: 358
Depending on the network connectivity I would like to show varying content, so I would like to determine whether a device supports 4G or 3G connectivity. How can I do this? I tried looking for a solution, but haven't been able to find anything.
Upvotes: 0
Views: 38
Reputation: 598
You can use cordova-plugin-network-information
plugin to check the current network state of the user
$ionicPlatform.ready(function() {
var networkState = $cordovaNetwork.getNetwork();
console.log('network state: ',networkState);
if (networkState == Connection.CELL_4G) {
//show the contents to the user while user is in 4g
}else{
//show the contents to the user if not 4g
}
})
The available values of the network state are
Upvotes: 1