Skip to content
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

Network.type is throwing as none after 24 hours of idle #64

Closed
iamroof opened this issue Aug 7, 2018 · 20 comments
Closed

Network.type is throwing as none after 24 hours of idle #64

iamroof opened this issue Aug 7, 2018 · 20 comments

Comments

@iamroof
Copy link

iamroof commented Aug 7, 2018

After 24 hours of idle time, if I try to access network type, plugin throwing as none even though mobile is connected to network.

@janpio janpio added the support label Aug 7, 2018
@janpio
Copy link
Member

janpio commented Aug 7, 2018

What are the exact steps to reproduce this? Start with cordova create and include all necessary steps to build the app - or upload a minimal example to Github and describe the steps to reproduce this. Thank you.

@NeoLSN
Copy link

NeoLSN commented Aug 21, 2018

I can also confirmed that.
Phone Model - Xiao Mi Mix 2.

@apache apache deleted a comment from candemore1024 Aug 22, 2018
@apache apache deleted a comment from candemore1024 Aug 22, 2018
@janpio
Copy link
Member

janpio commented Aug 22, 2018

@iamroof Was your issue also with Android?
@NeoLSN What Android version is running on that device?

What plugin version?
What Cordova CLI and Cordova platform version?
What code are you running?

@NeoLSN
Copy link

NeoLSN commented Aug 22, 2018

@janpio Android 8.0 / 2.0.1 / 8.0.0 / ionic-angular

@iamroof
Copy link
Author

iamroof commented Aug 22, 2018

@janpio Hi, This issue is only with android. Below is the dev environment

Ionic v3.20.0
Angular v5.2.9
Cordova Android v6.4.0
cordova-plugin-network-information v2.0.1

Phone Model : Nexus 5x - Android v7, Lenovo K4 Note - Android 6

This issue occurs in almost all tested mobiles.

isNetworkAvailable(): boolean{
        return (this.network.type === "none") ? false : true;
    }

Above sample snipet is used to check online/offline.

Reproduce Steps:

Consider application has a button which will consume rest services. Network will be checked before hitting rest services.

  1. Open Application
  2. Click the button. Network.type gives wifi.
  3. Lock your mobile.
  4. Unlock your mobile after 24 hours. You will be in same page of application
  5. Click the button again. It gives Network.type as "none" (Checked browser for online connectivity)

This issue will be resolved after killing and reopening the application

@janpio janpio added bug and removed support labels Aug 22, 2018
@janpio
Copy link
Member

janpio commented Aug 22, 2018

Nice reproduction steps @iamroof - that should be enough for a developer to debug this.

@TMesdo
Copy link

TMesdo commented Sep 10, 2018

Same here and I've also problem in this case :

  1. Connect to WiFi A + 4G (navigator.connection.type : wifi)
  2. Move enough to lost WiFi A and phone switch to 4G (navigator.connection.type : 4g)
  3. Come back to auto reconnect to WiFi A + 4G (navigator.connection.type : none)

@regiMario
Copy link

regiMario commented Oct 24, 2018

I'm having the same issue with version 2.0.1. I use an app the next morning and it says no network although i have WIFI.
I haven't been able to reproduce it with say airplane mode on/off either. I'm running 7.1.1 on a Sony Xperia E6883 dual sim model.
Is there any way to give this thing a kick to get it to recheck as a workaround?

@philliphartin
Copy link

I am also having this issue on iOS, but for me, I just have to simply flick on airplane mode on and off for the network.type to always return NONE

@janpio
Copy link
Member

janpio commented Oct 30, 2018

Create a new issue please @pjhartin as this seems to be a totally different issue (iOS instead of Android) than this one. Otherwise your problem will get lost.

@anaaChacon
Copy link

+1

@anaaChacon
Copy link

anaaChacon commented Nov 6, 2018

What is the solution?

@shineabel
Copy link

+1

@shineabel
Copy link

Is there any solution?

@Siva021
Copy link

Siva021 commented Jan 16, 2019

Is there any alternative solution for this particular issue?? It seems like important

@anaaChacon
Copy link

anaaChacon commented Jan 18, 2019

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.

@BurkusCat
Copy link

Still seeing the issue with @PieterVanPoyer 's forked version. From my experience, it has been happening closer to the 36 hour mark.

@shineabel
Copy link

Still seeing the issue with @PieterVanPoyer 's forked version. From my experience, it has been happening closer to the 36 hour mark.

+1

@paridaJhansi
Copy link

network.connection.type is thorwing unknown in case of ios 14 in case of 4g connection. please help if anyone has faced this issue.
plugin version is 2.0.3

@PieterVanPoyer
Copy link
Contributor

PieterVanPoyer commented Oct 22, 2020

network.connection.type is thorwing unknown in case of ios 14 in case of 4g connection. please help if anyone has faced this issue.
plugin version is 2.0.3

-> I think you should make a comment on next issue: #97
That issue is about ios and unkown connection type.
This issue is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

13 participants