Comments (5)
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?
from cordova-plugin-network-information.
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.
- cordova create hello com.example.hello HelloWorld
- cordova plugin add cordova-plugin-network-information
- edit index.js in hello\www\js and add this to onDeviceReady
document.addEventListener("offline", function (e) {
alert ("offline detected!");
}, false);
- cd hello
- cordova platform add android
- 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.
from cordova-plugin-network-information.
I don't believe the apache network plugin blocks any connections as it just simply listens to the 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), 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.
from cordova-plugin-network-information.
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.
from cordova-plugin-network-information.
Ok, I'll close this issue. If you need further support, consider joining us on our slack, or if you think you've found an issue, then feel free to open a new ticket.
from cordova-plugin-network-information.
Related Issues (20)
- IOS 13.4 not working offline HOT 2
- core.js:6014 ERROR RangeError: Maximum call stack size exceeded HOT 2
- bug: 'onConnect' does not work as expected HOT 10
- Refactor eslint to use cordova-eslint HOT 1
- Drop support for node < 10. HOT 1
- Version 2.0.2 from npmjs is crashing some devices with Android 10, on startup. HOT 9
- 5G detection HOT 13
- Correct network detection API calls deprecated on Android and iOS HOT 2
- network.connection.type is giving value as unknown in case of IOS 14 HOT 2
- Under no network conditions, start the App HOT 1
- What exactly is triggering online/offline events? HOT 2
- How to install specific version? HOT 2
- what 's new in version 3.0 ? should I need to update? HOT 1
- Issue with Ionic-native/network onConnect() on upgrade to Angular 10 HOT 1
- network.type is set to 'wifi' even when iPad Air is set to flight modus or when I am turning off WiFi
- Wrong typing for Connection
- 5G detect support HOT 4
- Network Up and Down Speed in android
- Navigator.connection support
- #throwInvalidProviderError HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-network-information.