Hi community,
Do you know way to get the IP address of device ?
I dont find any plugin Cordova.
Hi community,
Do you know way to get the IP address of device ?
I dont find any plugin Cordova.
jQuery
$.getJSON( "http://jsonip.appspot.com/",
function(data){
alert( data.ip);
}
);
Or with angular and an other service (because with jsonip: "Over Quota
This application is temporarily over its serving quota. Please try again later."
var json = ‘http://ipv4.myexternalip.com/json’;
$http.get(json).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
alert(JSON.stringify(data));
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
In fact, I search a internal device solution without external service.
You can take a look at this plugin, but I haven’t test it.
This plugin work only for Wifi
The goal is to provide ip addrress and gateway of the WiFi network on Android and iOS
Future goals might include a more general network information plugin to provide details on default gateway and ip address of all interfaces.
And he dont work
W/PluginManager( 8035): THREAD WARNING: exec() call to IpAddress.get blocked the main thread for 42ms. Plugin should use CordovaInterface.getThreadPool().
E/WifiStateMachine( 561): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0,04 rxSuccessRate=0,10 targetRoamBSSID=any RSSI=-66
E/WifiStateMachine( 561): WifiStateMachine starting scan for "******"WPA_PSK with 2412
I/wpa_supplicant(31889): wlan0: CTRL-EVENT-SCAN-STARTED
E/ ( 3420): invalid crash request of size 4 (from pid=9550 uid=0)
No solutions to get IP with Java code ?
Alternative can be to use external service like :
Were you able to get something to work?
Nothing without using an external service …
#=================Tutorial================
I found time to write you a tutorial including a working example. And I can guarantee no external service is required.
###Click here.