Entries Tagged as "Phonegap"

Phonegap: detecting correct connection type on iOS 7.1 iPad

I just spent 2 hours debugging a Phonegap iPad app. The app downloads a library of images and videos to localStorage, but only if the device is currently on WiFi. The iPads do have a cellular 4G connection as well, but the data transfer would be too costly, the client said.

In all tests the files downloaded fine, and all was good. Untill a few days back: now the app constantly shows my custom msg "downloading files (waiting for WIFI)". It turned out the iPads were updated to a newer iOS version. While debugging, the network.connection.type now always returned "cellular", even when cellular was disabled on the iPad.

Solution? Turned out to be simple: overwrite the old CDVReachability.m and .h files (version 2.2) with the latest ones, version 3.5. You'll need to rename references in the 2 files from "Reachability" to "CDVReachability".
Or... just download these 2 files here, and add them to:

/plugins/org.apache.cordova.network-information/src/ios/
/platforms/ios/{app name}/Plugins/org.apache.cordova.network-information/

Hope it helps you out, I will try to add a pull request as well.

No Comments

leash-environment