I am building an app using Sencha Touch 2. According to their documentation, and multiple other sources on the web (1, 2), I can get the connection type by using Ext.device.Connection.getType()
But on this line:
var connection = Ext.device.Connection.getType();
I get the following error on an Android device:
TypeError: Cannot read property 'type' of undefined
When running in Google Chrome on my desktop computer, it always returns null. Although, if I use the javascript console in Chrome to call Ext.device.Connection.isOnline()
, this returns true, and getType() now starts returning 'Unknown connection' instead of null.
This is the relevant part of my config.xml (probably don't need all of these, but I have tried with only the two first and the two last, without changes):
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/geolocation" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="NetworkStatus">
<param name="android-package" value="org.apache.cordova.NetworkManager" />
</feature>
All other Cordova functionality works as expected, so I believe the framework is installed correctly. What am I doing wrong, and/or what can I do to figure this out?