GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-11T03:57:22.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Release 2.1.0, Sprint 2012-13 Core |
Components | Android |
Labels | SupportTeam, core, module_network, qe-testadded, regression |
Reporter | Daniel |
Assignee | Max Stepanov |
Created | 2012-05-07T12:43:20.000+0000 |
Updated | 2014-03-13T17:45:14.000+0000 |
I recently updated from Titanium SDK 1.7x to 1.8.2. The Network change listener does not work anymore.
Ti.Network.addEventListener("change",function(e) {
Titanium.API.debug("Network changed");
if (Titanium.Network.online) {
Titanium.API.debug("Network is available");
}
});
Under 1.7.5 the log messages are printed, in 1.8.2 (and the most recent 1.8.3) it stopped working. I'm testing on an HTC Disre HD with Android 2.3.5. I was able to recreate it with above code added to the simplest test application
i have the same issue
Sent [PR #2423](https://github.com/appcelerator/titanium_mobile/pull/2423) to resolve issue.
With SDK 2.1.0.v20120618154152, I was unable to get the event to fire. I tried on two devices (one without cell capability) and saw many indications in the log of the network change, but not the target text from the sample code. See attached log.
Eric, I was able to test this fine by turning the wifi on the device on/off. The device also had no cellular network capabilities. Could you provide steps to reproduce the failure you saw on this ticket? I know you talked about it yesterday, but if you could refresh my memory and also keep a record here for others.
I tested my Android, network change event fired correctly. But Ti.Network.NETWORK_WIFI is null, so below code doesn't work. Ti.Network.addEventListener('change', function(e) { if(Ti.Network.networkType == Ti.Network.NETWORK_WIFI) { Ti.API.info("Network changed to Wi-Fi!"); } });
Satoshi, could you please open a new issue for that property being null. I imagine the other NETWORK_ constants are null as well.
@Josh, just following-up from our conversation. Seems as though when I disabled the access point, the device switched to another access point. This may have prevented the listener from firing. I will attempt to verify this ticket again tomorrow.
Cannot reproduce on GalaxyTab with 2.1.0 RC
Fixed by PR https://github.com/appcelerator/titanium_mobile/pull/2423
Verified fixed with SDK 2.1.0.v20120626130259 using the following code:
Re-opening to edit label
Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5011