-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onchange() method not working #1173
Comments
Check #1043. |
Hi bgondy. As far as I can see, this is supposed to be closed and updated? I'm using the current version 2.8.0 of ionic-native. |
I have no idea if they have published a new release with the fix, maybe in v2.8.1. If not, you can still use the workaround I've posted. |
I guess it's published. At least before I updated ionic-native, I received the error "no such method", as posted in the other issue. After updating ionic-native to 2.8.0 I didn't receive this error anymore, so I assumed the fix is published. But nothing else happens, as well ;-) |
I'm using 3.10.3 and I'm getting a TypeScript error In my connectivityService, I have this:
I wrote this to mimic the behavior of
|
I copy pasted the example from.the docs and had no error. Are you sure that you try to access the plugin AFTER platform.ready()? |
@danielsogl Yes, everything is after platform.ready(), inside a Here's my ionic info:
|
Hello my mistake added the function to the mock class. I forgot because it was running in the browser. |
I'm developing a mobile app using Ionic 2. I want to implement a function that sets a flag to true if the user is logged in to a certain wifi network. Otherwise the flag is to be set false. It is important that the flag is permanently updated when the network connection changes and even if the app is running in background.
Therefore I want to use the Ionic Native Network Plugin and it's "onchange()" method. I tried to put this to Ionic's "app.component.ts" in the "initializeApp()" method like this:
The observable seems not to be notified when the network changes (i.e. change to another wifi or disconnect wifi). However, when I use "onConnect" it seems to work.
Is this a bug in onchange()? Or am I doing something wrong here?
Additionally: Did I put it at the wrong place? Where would you put the call of the Network.onchange() method, if not to initializeApp()? Important: The observable needs to be called in all cases, even if the app is running in background!
Thank you, guys!
The text was updated successfully, but these errors were encountered: