3g - Apache Cordova broadband -
i haven't been able find information network restrictions , cordova. question how can prevent or restrict use of mobile (3g/4g) broadband in apache cordova 5 app?
you use following plugin. check connection type , act on connection type. example:
function checkconnection() { var networkstate = navigator.connection.type; var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g connection'; states[connection.cell_4g] = 'cell 4g connection'; states[connection.cell] = 'cell generic connection'; states[connection.none] = 'no network connection'; if(!states[connection.wifi] || !states[connection.ethernet]) { alert('your current connection type: ' + states[networkstate] + ' not supported in app!'); // execute want return; } } checkconnection();
Comments
Post a Comment