You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/04/07 19:42:57 UTC

[GitHub] [cordova-plugin-network-information] jringbox opened a new issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

jringbox opened a new issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106
 
 
   # Bug Report
   
   ## Problem
   net::ERR_INTERNET_DISCONNECTED error occurs when cordova-plugin-network-information plugin is added and no internet connectivity is available.
   
   ### What is expected to happen?
   cordova-plugin-network-information should provide ability to check whether internet connectivity is available but not terminate the application from the lack of internet.  What I plan to do by design is check within VueJS context for network connectivity and show a VueJS offline page but I can't do this is cordova-plugin-network-information prevents me from getting to VueJS context.
   
   ### What does actually happen?
   net::ERR_INTERNET_DISCONNECTED error occurs when cordova-plugin-network-information plugin is added and application is halted from proceeding to VueJS pages.
   
   ## Information
   The following steps can be taken to reproduce the issue.
   
   1. vue create offline (use default settings)
   2. cd offline
   3. vue add cordova (press enter on everything and only select android platform)
   4. cd src-cordova
   5. cordova plugin add cordova-plugin-network-information
   6. add the following to VueJS index.html at bottom.
   
   `<script type="text/javascript" src="index.js"></script>`
   
   7. create index.js with the following.
   
   ```
   var app = {
     initialize: function () {
       document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
     },
     onDeviceReady: function () {
       document.addEventListener("offline", function (e) {
         alert ("offline detected!");
       }, false);
       this.receivedEvent('deviceready');
     }
   };
   app.initialize();
   ```
   
   8. setup Android Studio for Pixel-2-API-R emulation
   9. npm run cordova-serve-android 
   10. After android emulator has application installed, go to top navigation menu and turn off cell via the bi-directional icon.
   11. Navigate and run VueExampleAppName which was just installed
   12. Upon startup, you should get something similar to the following where LOCALHOST is the machine's local IP address.
   
   ```
   Webpage not available
   
   The webpage at http://LOCALHOST:8080/ could not be loaded becasue:
   
   net::ERR_INTERNET_DISCONNECTED
   ```
   
   While it is true that there is no internet, the problem is that the plugin is supposed to only provide network information.  The application should still allow to run and show the VueJS page.  Removing the plugin, does resolve the issue but network detecting for user notification is still desired for complete product implementation.
   
   The desired result would be to show the VueJS page regardless of whether internet is available.  The plugin does work fine if WiFi is not available but not when there is no internet/cell network.
   
   ### Command or Code
   See above.
   
   ### Environment, Platform, Device
   Development is done on Windows 10 Enterprise.  Not sure if it matters, but I have Android Studio version 3.6.1 which was used to setup Pixel-2-API-R android emulator.
   
   ### Version information
   Only android platform is use as shown in the example above.
   
   Dependencies in package.json are as follows.
   
       "cordova-android": "~8.1.0",
       "cordova-plugin-network-information": "^2.0.2"
   
   VueJS package.json does have vue-cli-plugin-cordova which might be relevant.  The devDependencies for VueJS package.json is as follows.
   
       "@vue/cli-plugin-babel": "~4.3.0",
       "@vue/cli-plugin-eslint": "~4.3.0",
       "@vue/cli-service": "~4.3.0",
       "babel-eslint": "^10.1.0",
       "eslint": "^6.7.2",
       "eslint-plugin-vue": "^6.2.2",
       "vue-cli-plugin-cordova": "~2.4.1",
       "vue-template-compiler": "^2.6.11"
   
   ## Checklist
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] breautek edited a comment on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-610587371
 
 
   > Upon startup, you should get something similar to the following where LOCALHOST is the machine's local IP address.
   
   Forgive me if this question doesn't make sense (I am not familiar with VueJS at all...) but are you actually running a local webserver on the device itself or is this a placeholder for a web server on your local private network?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-611045466
 
 
   Ok, I'll close this issue. If you need further support, consider joining us on our [slack](http://slack.cordova.io/), or if you think you've found an issue, then feel free to open a new ticket.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-610587371
 
 
   > Upon startup, you should get something similar to the following where LOCALHOST is the machine's local IP address.
   
   Forgive me if this questino doesn't make sense (I am not familiar with VueJS at all...) but are you actually running a local webserver on the device itself or is this a placeholder for a web server on your local private network?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-610966410
 
 
   I don't believe the apache network plugin blocks any connections as it just simply listens to the [ConnectivityManager](https://developer.android.com/reference/android/net/ConnectivityManager). If this plugin **is** blocking connections, I would fail to understand how.
   
   To re-iterate my previous question, the reason why I asked whether you're using local host or if you were using a private IP address is, if you were running a dev server (as described [here](https://www.npmjs.com/package/vue-cli-plugin-cordova#in-development-mode)), you're device **REQUIRES** to be on the same network as the machine hosting the dev server. In other words your dev machine and your phone needs to be connected to the same router.
   
   So if you're turning off your wifi and only using your phone's mobile data, then you are not using the same network as your dev server because you're disconnecting yourself from your router and therefore the dev server is not accessible.
   
   Hope this makes sense.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] jringbox commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
jringbox commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-611026533
 
 
   Ah.  I think I see what you are saying.  I'm dumb.
   
   Since VueJS stands itself up as a server and I turned off wifi and internet, it had no way to get to the VueJS service to serve the page -- hence the error.
   
   I see the conundrum I need to think about.
   
   Thanks.  I think we are resolved here on the issue.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] breautek closed issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
breautek closed issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-network-information] jringbox commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information

Posted by GitBox <gi...@apache.org>.
jringbox commented on issue #106: net::ERR_INTERNET_DISCONNECTED with cordova-plugin-network-information
URL: https://github.com/apache/cordova-plugin-network-information/issues/106#issuecomment-610957727
 
 
   That's basically what it is.  VueJS is used to generate web content and we're using cordova to wrap it and avoid straight javascript for webpage and using VueJS to generate our pages.  When building, all VueJS content in the main public directory for VueJS is copied to src-cordova/www.  VueJS places hooks in the cordova www/js directory and updates index.html if necessary.  After that, a normal cordova build from src-cordova is done to produce an APK.
   
   Just now, I created a standard cordova project with the following.  This is essentially the same example above but without VueJS and it runs with no issues.
   
   1. cordova create hello com.example.hello HelloWorld
   2. cordova plugin add cordova-plugin-network-information
   3. edit index.js in hello\www\js and add this to onDeviceReady
   ```
         document.addEventListener("offline", function (e) {
           alert ("offline detected!");
         }, false);
   ```
   4. cd hello
   5. cordova platform add android
   6. cordova build android
   
   This seems to imply cordova has no issues but when I have VueJS work with this plugin then it doesn't work.  I can't figure out where the root problem is.
   
   The question is whether cordova-plugin-network-information is blocking something to VueJS' cordova plugin for offline or is VueJS' cordova plugin doing something different with the presence of cordova-plugin-network-information when offline or is it something else?
   
   I started here but maybe I'm wrong and should post to VueJS cordova plugin.  I felt this was cordova-plugin-network-information plugin issue but I honestly am not sure exactly where the issue is coming from.
   
   As fyi, I did start with a cordova project with VueJS but hot deploy and laying out VueJS structure in cordova failed miserably with newest VueJS version.  So, that's why this is a VueJS project with cordova plugin.  Just in case you're wondering.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org