#26215

Samer
Keymaster

Sorry but going to have to ask for your help again. The first link you sent uses compiled libraries but from my understanding JS alone can do it. So I am trying to modify my plugin https://github.com/salbahra/NetworkInterfacePlugin to support the device. I read that the qnx global stores most of the information needed and specifically the connection is found here:

window.qnx.webplatform.device.activeConnection

I just have no way to figure out which way to get the IP. Any idea?

Update: This is what I have so far:

function getIP() {
var con;

try {
con = window.qnx.webplatform.device.activeConnection;
}
catch (e) { return false; }

if (!con || con.type == 'cellular') return false;
return con.ipAddress; // This is the made up part lol
}

module.exports = {
getIPAddress: function (success, fail, args, env) {
var result = new PluginResult(args, env),
ip = getIP();

if (!ip) {
result.error();
} else {
result.ok(ip);
}
}
};