Coder Social home page Coder Social logo

Comments (5)

breautek avatar breautek commented on June 13, 2024

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.

jringbox avatar jringbox commented on June 13, 2024

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);
  1. cd hello
  2. cordova platform add android
  3. 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.

breautek avatar breautek commented on June 13, 2024

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.

jringbox avatar jringbox commented on June 13, 2024

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.

breautek avatar breautek commented on June 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.