Nate
Nate

Reputation: 1875

Meteor with Cordova Offline Application integration

As I understand it, Cordova is basically just a WebView. When the cordova/meteor app initially attempts to start-up and the mobile device is offline the application never loads. Obviously this is because a connection to the server cannot be made.

Some ideas would be maybe a notification, or webpage instructing that a online connection is needed that is included in the bundled native application.

Upvotes: 0

Views: 293

Answers (1)

unobf
unobf

Reputation: 7244

You should have some basic set of code that resides on the device. If you do not at least have an index.html and some JavaScript inside that to listen for deviceready, then you cannot do much at all.

There is a plugin for getting network information https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md but even without this, you are able to get offline|online notifications with code like this (assuming you have included jQuery in your local set of files)

jQuery(window).on('offline', function (e) {
    // do stuff when going offline
}).on('online', function (e) {
    // do stuff when going back online
});

Upvotes: 2

Related Questions