This PR adds subnet support (i.e. netmask info) for both iOS and Android. (maybe more platforms in a future PR)
The subnet info is provided to the onSuccess() callback as a separate argument (string value).
Eg
function onSuccess(ip, subnet) { }
This was simply following your comment:
I think to avoid a soup of callbacks we can probably return the netmask in the IP request as a seperate argument in the callback.
The code can easily return additional information now using separate arguments if you choose to in the future. However, depending on how much additional information you want to provide in the future I'd maybe suggest providing an object of additionalInfo eg { subnet: '255.255.255.0', gateway: '192.168.1.1', broadcast: '...' } etc to avoid "argument hell". But I'll leave this future decision to you.
I've tested this plugin on an iPhone 6 plus, iPad 2017, Galaxy Note II and Moto G3 and all work successfully. iOS and Android behave a little differently, where iOS seems to give the Carrier info when WiFi is on, but Android will not give the Carrier info until you turn WiFi off. i.e. Android only provides the currently used radio (but I believe this was the behavior before this PR anyway). The onError() callback is called when the respective radio is disabled (i.e. previous behaviour). i.e. Airplane mode, WiFi off, No SIM card etc
To test this PR on your own device, prior to merging, run the following commands:
This PR adds subnet support (i.e. netmask info) for both iOS and Android. (maybe more platforms in a future PR)
The subnet info is provided to the onSuccess() callback as a separate argument (string value). Eg
This was simply following your comment:
The code can easily return additional information now using separate arguments if you choose to in the future. However, depending on how much additional information you want to provide in the future I'd maybe suggest providing an object of additionalInfo eg
{ subnet: '255.255.255.0', gateway: '192.168.1.1', broadcast: '...' }
etc to avoid "argument hell". But I'll leave this future decision to you.I've tested this plugin on an iPhone 6 plus, iPad 2017, Galaxy Note II and Moto G3 and all work successfully. iOS and Android behave a little differently, where iOS seems to give the Carrier info when WiFi is on, but Android will not give the Carrier info until you turn WiFi off. i.e. Android only provides the currently used radio (but I believe this was the behavior before this PR anyway). The
onError()
callback is called when the respective radio is disabled (i.e. previous behaviour). i.e. Airplane mode, WiFi off, No SIM card etcTo test this PR on your own device, prior to merging, run the following commands:
Then simply add to
/www/js/index.js
in the onDeviceReady function()Finally
P.S. I updated the README to reflect the new feature and also updated the version number to 1.2.0 since a feature was added and semver rules etc.
P.P.S. great plugin. Happy to contribute ;)
Closes #12