android - IBM Worklight 6.1 - How to check connection type? -


can 1 me in knowing connection type using worklight api?

i tried using getnetworkinfo(callback) not helpful knowing whether 2g or 3g both iphone , android.

worklight apps bundled version of cordova.

you can use cordova connection api.
api able discern between 2g , 3g connection types , others.

for example, in your-project\apps\your-app\common\js\main.js, add following wlcommoninit():

function wlcommoninit() {     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';      alert('connection type: ' + states[networkstate]); } 

worklight apps generated required configuration (config.xml, etc...), no further setup needed; adjust code snippet app.

with iphone 5s , specific carrier using, got "cell generic connection" when using 3g, , "wifi connection" when using wifi. depends on carrier setup suspect, api asked for.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -