-
Notifications
You must be signed in to change notification settings - Fork 321
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
Type none when change type Network un app background #82
Comments
Yeah, I am also experiencing the same, i am getting network type none when app is idle for more than 20mins in the background. After reopening the app or changing to Airplane mode network working fine.. Seems like this issue is occurring to ionic latest |
the solution that it poses @PieterVanPoyer has solved the problem for me pm android, but in them there is iOS no solution, at the moment I am satisfied. |
I have the same problem (using ionic 4). Is there a solution for this? |
Looks like there is a PR to fix this on Android per annaChacon's comment (it just hasn't been merged): #74 No idea about the status of the problem on iOS. |
Hi ✋ , The PR has been merged, you can now install the plugin with:
in order to have the last version, while the team make a release PS: As long as I know, I couldn't reproduce this issue on iOS. Only on Android 🤔 |
Was this merged into 2.0.2? And a related item - I don't seem to get events when the app is in the background. Is that addressed with this PR too? |
Hello, The #74 does not solve the network change trigger when the app is idle (or in the background) for android. The Pull Request solves that the networkinfo is not reliable when the app is in the foreground. Android can stop the listeners on the BroadcastReceivers to save battery power when the app becomes idle. Kind regards, |
@halindrome in our company we do not rely on the 'offline' and 'online' events.
As an addition on my previous comment, in my opinion the javascript part of an app can go idle too when android decides to save battery and when the app is in the background. What is the use case for you to receive these events while the app is in the background? Kind regards, |
Our application does a lot of things while the app is in the background. In general, on Android, these are successful. Even when the app is running javascript tasks those work in the background most of the time. I was relying upon this plugin (which has a non-JS component) to deliver events when the network changes state. One of the things that is unique about our application is that it prefers to talk to a local gateway on a local network. A specialized appliance we supply to our customers. In many environments, the devices on which our application is installed do not even have access to the internet (and are not cellular or do not have their cellular data enabled). In these cases, especially when the WiFi support in the environment is uneven, we see a lot of network problems. Our application is designed to work around these dropouts by queueing messages and resending them when the network becomes available. I will see what I can do with the Anyway, thanks for the pointer! [edit] I attempted to rely upon this property of the navigator object. Under cordova (under ionic 4) the state of the navigator.connection.type property is not updated when the app is in the background either. So the various services we have running continue to attempt to talk to the network even when it is disconnected. Now, I could look at the response of a network request and realize that we have lost connection and act upon that, but I am surprised that this property is not being updated. Is there something we need to do to ensure that it reflects the reality of the device's environment? |
Just to know, did this work before the 2.0.2 release? |
We have the same issue when the data saver is on in Android. We have these problems both in version ^1.3.4 and 2.0.2. |
Hey, Do you mean you have a problem with saving data when the app is idle or in the background? Is it possible for you to check version 2.0.1? Kind regards, |
@PieterVanPoyer So data saver (Connections > Data usage > Data saver) is a setting in Android. |
Hey Englund, Thanks for the info. I wasn't aware of the android Data Saver functionality. This thread is becoming a bit complicated and multithreaded. Then we are able to fix halindromes problem here, and address the Data Saver bug in another issue. Kind regards, |
@anaaChacon Hey. Is the original issue still occuring? If not, can you close this issue? Kind regards. |
Hello, I have a problem with Internet connections, I use the ionic Network plugin and the problem I have is, when the connection type changes from wifi to data and the application is in the background the type of connection it receives is NONE, I have to kill the application and start it again so that everything goes correctly, has anyone experienced this problem?
The text was updated successfully, but these errors were encountered: