PDA

View Full Version : Ext.device.Connection: online status & connection type not updated on iOS app resume



VladimirTechMan
28 Oct 2012, 8:53 AM
Ext version tested:

Sencha Touch 2.1.0 RC2
Sencha Cmd 3.0.0.230
Description:

Sencha Touch 2 apps (native-packaged for iOS) that are using Ext.device.Connection will get wrong online status and connection type when the application is paused, then the connection status/type changes, and then the application is resumed.
Steps to reproduce the problem:

Create a Sencha Touch 2 app that internally uses Ext.device.Connection.isOnline() and/or Ext.device.Connection.getType() and in such a way that a user action can trigger calling them (e.g. on tapping a button)
Package the application as native iOS application
Install the application on iOS device
Start the application on iOS and note the connection status and type returned
Pause the application
Go to Settings of iOS and change the actual connection status or type (e.g. if there was a connection to Internet, then go to the airplane mode, or switch off Wi-Fi, or alike)
Resume the application and make it calling Ext.device.Connection.isOnline() and/or Ext.device.Connection.getType() once again (with the appropriate user action)
Note the connection status and type returned this time
The result that was expected:

The returned connection status and type are in sync with the actual connection status and type on the device
The result that occurs instead:

The returned connection status and type remain exactly the same as they are when the application is started first
Test Case:


Create a new Sencha Touch application with 'sencha generate app'
Replace the original Main.js file with the file attached to this report
Package as native iOS app and install on iOS device
Start the iOS app on the device, note the connect status and type
Pause the application, change the connection status/type, and then resume the application
Press the "Refresh Info" button to update the connection status and type. See the connection status and type returned.

mitchellsimoens
29 Oct 2012, 5:12 AM
First thing I see is you are breaking inheritance by not calling the parent in initialize. You need to add a this.callParent();

VladimirTechMan
29 Oct 2012, 6:23 AM
I updated the attached file. Well-spotted, Mitchell. Thanks. Mea culpa.

VladimirTechMan
9 Nov 2012, 12:19 PM
Hi Mitchell,

Any chance you can get back to this one, please?

VladimirTechMan
21 Nov 2012, 12:13 PM
Mitchel, please, review

ayuzhin
23 Jun 2013, 10:12 PM
Subscribe to the issue, when it will be fixed?


Sencha Touch 2.2.0
Sencha Cmd v3.1.2.342

Still does not work

appsgenii
21 Aug 2013, 10:04 PM
Ext.device.Connection does not work on native IOS after ST 2.0.1

VladimirTechMan
26 Aug 2013, 11:17 AM
Just a quick note to all those still suffering from that unpleasant issue (to be fixed some day, I hope):

If you do need to know the exact type of current connection. Then... well, I am sorry, but that has to be fixed by Sencha developers. I cannot think of any good workarounds here, on the JavaScript side.

But...
If you only need to check from your app (packaged and running as native) if it is on-line or not. Then you have a simple and easy alternative:

Check navigator.onLine. This one is from the JavaScript API in WebView, not a part of bridging to native mobile OS APIs.

kidmanmatch
27 Nov 2013, 3:02 AM
Thank you so much for your thread, its really helped me to get connection status, I tried with Ext.device.connection so may times but no success in my IPod, navigator.onLine worked for me both in IOS and Android

VladimirTechMan
27 Nov 2013, 6:40 AM
You're welcome!