Ionic Mobile Network Information


#1

Hello,

I am building an iOS app with Ionic and I need to get some network informations like MNC and MCC,
Do you know how to ? using $cordovaNetwork ?

Thank you!


#2

Docs are available on that link


#3

Thank you but I don’t see how to get the mobile network code ?


#4

Hi @Falk,

You can use this as a factory… I Just needed ONLINE and OFFLINE so I have modified code… Hope this helps

var network_status = NetworkFactory.checkConnection();

MyApp.factory(‘NetworkFactory’, [’$http’, ‘BASE_URL’, function ($http, BASE_URL) {
var NetworkFactory = {};
NetworkFactory.checkConnection = function () {
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = ‘online’;
states[Connection.ETHERNET] = ‘online’;
states[Connection.WIFI] = ‘online’;
states[Connection.CELL_2G] = ‘online’;
states[Connection.CELL_3G] = ‘online’;
states[Connection.CELL_4G] = ‘online’;
states[Connection.CELL] = ‘online’;
states[Connection.NONE] = ‘offline’;
window.localStorage.setItem(“network_status”,states[networkState]);
return states[networkState];
};
return NetworkFactory;
}]);


#5

Thank you @nagarjunbn8 nagarjunbn8 I found that plugin https://github.com/pbakondy/cordova-plugin-sim