Giter VIP home page Giter VIP logo

cordova-plugin-networkinterface's People

Contributors

dharders avatar keithbarrow avatar lordjabez avatar salbahra avatar schaumiii avatar winfinit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-networkinterface's Issues

FR: Support for GW ipadress

This plugin looks great, we would like to ask for a feature request on android and ios,

We need the ipaddress for the GW/Router the device is connected. I had a look on android and there is the possibility to do this, probably also on ios.

Could you have a look for it and integrate it.

FYI:
Perhaps if anything is working great, we would like in feature to propose to the ionic team to integrate this as ionic-native. If we find the time we can open a pull request on them. What do you think about it?

VPN address

Hi, first thank you for this great plugin.
Is it possible to retrieve the VPN ip address too if it is connected ?

Or a json array with all available connections, the device could be connected with ethernet for example

regards

add signal info?

Any chance of expanding this to get signal strength and connection info (aka ssid or tower id)?

(crosses fingers)

How to process IP address returned by getWiFiIPAddress()?

If I run getWiFiIPAddress() in the browser by running ionic cordova run browser, then alert shows IP address but if I run the same App is built for Android platform by ionic cordova run android and check DevTools in chrome for logs, an object is displayed.
If I try to access .ip and .subnet, it says that the properties do no exist.
Please help!

add support Windows 10 Universal Platform?

On Windows 10 I get the error Missing Command Error when calling getIPAddress. I guess you support only WP8 right?

Could you add the same functionality for Windows 10 please?

Does this plugin support android?

I am having trouble that this plugin works on IOS but not on android, in the repo it says it supports Android, Browser, iOS, and Windows 10 (I doubt that), and on the owner's website (https://albahra.com/projects) it is only listing IOS...

What is true here, am I wasting time trying to make this run on android or am I making a mistake somewhere?

Attempted to send a second callback for ID: networkinterface: networkinterface1757067064 Result was: "Invalid action"

This occurs on the latest 9 Cordova version (as well as a previous one that I updated from, I believe 8.x).

Referencing : #39

Just installing the plugin and running the app springs up this error.

2019-04-12 11:59:30.979 21202-21310/com. W/CordovaPlugin: Attempted to send a second callback for ID: networkinterface1757067064
Result was: "Invalid action"
2019-04-12 11:59:30.981 21202-21310/com. W/CordovaPlugin: Attempted to send a second callback for ID: networkinterface1757067065
Result was: "Invalid action"

This appears to explain the error (or be a symptom of) when I call getHttpProxyInformation:
Unable to get proxy info: Error while calling ''getHttpProxyInformation' 'protocol = null host = null
2019-04-12 11:59:30.992 21202-21202/com.GPSWalking.Team10 I/chromium: [INFO:CONSOLE(157)] "Unable to get proxy info: Error while calling ''getHttpProxyInformation' 'protocol = null host = null", source: http://192.168.1.128:8100/__ion-dev-server/ion-dev.js?v=3.2.2 (157)

Any usable example I can use like reference

Hi Samer,

I trying to use your plugin... I can see alert in sample function you provide comes with information but I am unable to modify it at all. The simple change of assigning ip to a different variable does not work ...alert in the code below comes always with info ... but variable afterwards remains undefined. Any guidelines where to look for will be greatly appreciated.

var ownIP;
function setOwnIP(){
networkinterface.getIPAddress(function (ip) { alert(ip); ownIP = ip; });
}

rgds
Juan Antonio

How to use in Ionic?

Hi, this plugin looks exactly like what I need, but I'm not fully sure how to use it in Ionic... any idea? How can I access this object?

Error :networkinterface is not defined

I am facing networkinterface is not defined..what could be a reason ?

In index.html

<script>
        try { 
            document.addEventListener("deviceready", onDeviceReady, false); 
            function onDeviceReady() { 
                networkinterface.getIPAddress(function (ip) { alert(ip); });
            }
        } catch (er) { alert(er); }
 </script>

networkinterface is undefined

Using the Quasar framework and wanted to easily grab the devices IP.

In the src-cordova folder I ran:
cordova plugin add cordova-plugin-networkinterface

Added <plugin name="cordova-plugin-networkinterface" source="npm" /> to the config.xml

Then, once the Vue component is mounted, I run:
networkinterface.getWiFiIPAddress( onSuccess, onError );

But networkinterface is always undefined. I thought this plugin added a global reference to networkinterface?

cannot find getWifiIPAddress function

running ionic 2.2.2, cordova 6.5.0

I did a console.log of the data
console.log("ni="+ networkinterface);
ni=function(){
}
console.log("ni="+ networkinterface.getWifiIPAddress);
ni=undefined

no idea what is going on.. help
200 /plugins/cordova-plugin-networkinterface/www/networkinterface.js
Can't find variable: networkinterface
and TypeError: networkinterface.getWiFiIPAddress is not a function (which is expected if it is undefined).

Publish v1.1.0 to npm (currently only 1.0.8 published)

Hey great plugin!

I followed your README instructions to use the new getWiFiIPAddress() and getCarrierIPAddress() instead of the old deprecated getIPAddress() but it didn't work as I used cordova plugin add cordova-plugin-networkinterface, which according to npm is only at version 1.0.8. Apparently the newer functions aren't defined in that version.

I guess the solution is to publish the latest version to npm or update your README to add from git master so your users aren't left confused.

Thanks again for the great plugin!

plugin_not_installed

In my code, I put the getIPAddress function in platform.ready()

constructor(
    public platform: Platform,
    public networkInterface:NetworkInterface
) {
   this.platform.ready().then(() => {
      this.networkInterface.getIPAddress().then(ipAddress => {
        console.log("ip-success:", ipAddress);
      }).catch(error => {
        console.error("ip-error:",error);
      });
    });
}

When I run these code on ios device, I get these console.warn

console.warn: "Native: tried calling NetworkInterface.getIPAddress, but the NetworkInterface plugin is not installed. "
console.warn: Install the NetworkInterface plugin: 'ionic cordova plugin add cordova-plugin-networkinterface'

and my error print

console.error: ip-error:plugin_not_installed

It says the plugin is not installed, however, I have added the plugin before and these is related plugin configuration in config.xml file.

First IP is not always the most relevant one

Hi,

When I use your plugin, I get an IP address that is not the actual one. I get a 10.0.x.x IP while my device info shows an 192.168.x.x (my dhcp configuration)

When I read your code, I see that you return the first address found.... could you return every addresses in getIPAddresses?

Thx and good job!!!

"use strict" angularjs

I tried to use this plugin to get the local ip address.
inside a angular2 (maybe also angular1) application the console shows a lot of errors.
i figured out that "use strict" will be added by transpiler typescript or other javascript compilers.
Is it possible to fix the plugin to work with "use strict"?
Does someone has the same issue?

i had bug

i used ionic 2
i install plugin cordova-plugin-networkinterface
cordova plugin add cordova-plugin-networkinterface
and after i used code
networkinterface.getIPAddress(function (ip) { alert(ip); });
but it error " networkinterface is not defined"

ReferenceError: networkinterface is not defined

I know it's been an issue before but I'm still having this issue. Whether I add "window" or not is still the same (although a different error message). And I've also made it sure that it will only run after the device ready event has been received.

I've created the app using Phonegap CLI and built it on Phonegap Build.

I added this on my config.xml:
<gap:plugin name="cordova-plugin-networkinterface" source="npm" />

Here's what my javascript look like:

var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        alert('Received Event: ' + id);
		
	setTimeout(function(){
		try{
			networkinterface.getIPAddress(function (ip) { 
				alert("IP: "+ip);
				function(error){
				alert("IP Error: "+error);
			});
		}catch(e){alert(e)}
			
	}, 1000);		
    }
};

I also tried it on runkit with the same result as mine which I got from NPM: https://runkit.com/589d9741aa6f95001497501d/589d9741aa6f95001497501e

Can you please take a closer look on what's causing this?

Thank you very much!

How to support Browser ?

Hello thanks for great plugin,
I tried get IP address from Browser that I used iframe for simulator

What I had read on Doc it said:
Supported platforms
Android
BlackBerry 10
Browser
iOS
Windows
Windows Phone

but it seems I could not able to get IP address code I followed on doc:

this.networkInterface.getWiFiIPAddress(function (ip) { alert(ip); });
this.networkInterface.getCarrierIPAddress(function (ip) { alert(ip); });

thanks for your help!

getWiFiIPAddress sometimes returns 0.0.0.0 on iOS (solution included)

This plugin doesn't seem to be maintained anymore, but in case anyone is using it and experiencing the issue mentioned in the title: This is because the plugin just goes through all en0 interfaces (which is wifi) and uses always the last one. It seems that there is sometimes more than one en0, but some of them with IP 0.0.0.0 (probably non-active ones). If one of the 0.0.0.0 happen to be looped through after the actual active en0 interface, the returned IP will be 0.0.0.0.

To patch this, you have to make some changes to CDVNetworkInterface.m, line 22 (within the getInterfaceiIP function):

Search for

if([name isEqualToString:interfaceName]

and change it to

if([name isEqualToString:interfaceName] && ![addr isEqualToString:@"0.0.0.0"])

Hope someone finds this helpful.

What would cause a call to 'getHttpProxyInformation' to fail when getWiFiIPAddress() succeeds?

I'm in the middle of debugging why my Ionic 3 application is unable to communicate with the internet. I've been able to confirm that my application receives an IP address using this helpful plugin, however, I cannot receive any proxy information of websites, which I think is a clue.

Upon calling getWifiAddress(), I get : WIFI IP: 10.66.61.134, Subnet: 255.255.224.0
However, upon calling getHttpProxyInformation('www.github.com'), I get : Unable to get proxy info: Error while calling ''getHttpProxyInformation' 'protocol = null, host = null

I believe this is unusual and unexpected.

So how can the app both have a valid IP / Sub but not get proxy information regarding a website? The app is connected to a functional network.

Is this a permissions issue? My Config.xml contains the following lines which I believe are relevant:


Support to get IPAddress with one call

It would be great if the plugin contained a function to get the first available IPAddress, trying to get wifi IP Address and, if it's not available, gets Carrier IP Address.

Doesn't work on cell network / ios

For the cell/3g network I get the onError callback with null.
But on WiFi I am successfully able to get the IP in the onSuccess callback.

Platform: iOS 9.x

Cannot install cordova plugin on with never cordova-android versions

Hi,

When I try to do cordova plugin add, I get this error:

ENOENT: no such file or directory, open '/Users/abu/Desktop/Solutions/neonbanking-frontend/node_modules/cordova-android/bin/templates/app/src/main/AndroidManifest.xml'

The same error appears on cordova-android 9.0.0 and 10.1.1

When I open the directory of cordova-android in node_modules, the manifest is there, but at a slightly different path.

Could it be that this plugin doesn't work on certian cordova-android versions?

Feature Request: Netmask

Would it be possible to add a function to also get the netmask of the network?
I use this plugin to get the ip address to scan a network for a server. To get the whole range of the network i use this plugin: IPSubnetCalculator
To geht the range i need the netmask.
Would be nice to get this feature in here ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.