Detecting a wi-fi connection

1
Hi!  A quick question, is it possible to detect if your tablet is connected to wi-fi in Mendix? I know that in the App Store or Google Play Store for example, some downloads are not triggered until the device knows that it is connected to wi-fi. This can be very handy for us when it comes to transferring large amounts of data.  Many thanks in advance!  Kind regards, Laxmi
asked
3 answers
3

Edit: I misread the question. Paul's answer is a better one. It could be done with a different plugin. I'll keep my answer as a reference on how to detect if an app is online/offline.

----

We include the Mobile Features widget in our mobile app examples (you can add it yourself, add it to a layout).

This uses Phonegap plugins. One of those is the ability to see if an app is online or offline (as in, is there an internet-connection or not)... This class will be added to the body, which you could use to display a message.

Here's the explanation: https://github.com/mendix/MobileFeatures#transition-classes

1. You add a text to your application, and give it a class: 'offline-message'. The text says something like 'It looks like your app is offline, please make sure there is an internet connection'.

2. You need to add some things to your styling (added to your CSS or .SCSS files):

.app-online .offline-message { display: none; }

.app-offline .offline-message { display: block; }

3. You could even make a more general class, something like 'hide-offline'. That way you could hide buttons when the app is offline.

This will make it possible for the user to spot any issues with their connection. This should work fine with any Mobile App that has this widget in its layout.

answered
2

AFAIK there's not default way to do this.

You could create a widget using a Cordova plugin though:

 

https://www.npmjs.com/package/cordova-plugin-network-information

answered
0

Thanks for the suggestions, you've been a great help :)

answered