{ "id": "174125", "key": "AC-6366", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2019-11-04T19:03:05.000+0000", "created": "2019-09-12T13:59:51.000+0000", "labels": [ "android", "api" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-11-04T19:03:06.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Reproduces also with SDK 8.1.0 GA\r\nOn Android Devices (tested on Samsung) the Titanium.Network.addEventListener responds only to WIFI changes and ignores completely the MobileData. \r\nSo for example if the MobileData is turned on and the Wifi is connected. \r\nWhen closing the WIFI the Titanium.Network.online will return false even though the phone has access to internet via MobileData. If you turn On/Off the mobile data the listener does not respond at all. ", "attachment": [ { "id": "66951", "filename": "console-log.rtf", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2019-09-17T06:34:52.000+0000", "size": 38384, "mimeType": "text/rtf" } ], "flagged": false, "summary": "Titanium.Network.addEventListener ignores Mobile Data on Android Devices", "creator": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "reproduced on Android Samsung devices but not on Pixel/Nexus emulators", "comment": { "comments": [ { "id": "451344", "author": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "just add this code snippet to an app.js\r\nTitanium.Network.addEventListener('change', function(e){\r\n\tTi.API.error('Network system state: ' + (Titanium.Network.online ? 'ONLINE' : 'OFFLINE'));\r\n\tTi.API.error('Network event state: ' + (e.online ? 'ONLINE' : 'OFFLINE') + ' on ' + e.networkTypeName);\r\n});", "updateAuthor": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-13T05:53:59.000+0000", "updated": "2019-09-13T05:57:03.000+0000" }, { "id": "451385", "author": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi,\r\nYes it reproduced with 8.1.1 GA", "updateAuthor": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-16T07:26:41.000+0000", "updated": "2019-09-16T07:26:41.000+0000" }, { "id": "451420", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~Claudiu Stefaniga]!\r\n\r\nWe have tested this issue using the provided sample code on Samsung galaxy A7 (2018) android 9. it's working as expected on our end.\r\n\r\n*Test Environment:*\r\n{code}\r\nAppcelerator Command-Line Interface, version 7.0.12\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 8.9.4\r\n npm Version = 6.10.0\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = 8.1.1.GA\r\n Target Platform = android\r\n{code}\r\n*Code:*\r\n*app.js*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#fff'\r\n});\r\n \r\nTitanium.Network.addEventListener('change', function(e)\r\n\r\n{ Ti.API.error('Network system state: ' + (Titanium.Network.online ? 'ONLINE' : 'OFFLINE')); Ti.API.error('Network event state: ' + (e.online ? 'ONLINE' : 'OFFLINE') + ' on ' + e.networkTypeName); }\r\n);\r\n \r\nwin.open();\r\n{code}\r\n*Test steps:*\r\n1. Create a new classic project.\r\n2. Copy the code and paste in app.js.\r\n3. Run the project on android device.\r\n4. After running the project, MobileData is turned on and the Wifi is connected.\r\n5. When closing the WIFI the listener access to the internet via MobileData.\r\n6. If you turn On/Off the mobile data the listener goes offline and online as well.\r\n\r\n*Test Output:* Please check the attachment section.", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2019-09-17T06:35:07.000+0000", "updated": "2019-09-17T07:55:23.000+0000" }, { "id": "451421", "author": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "on Samsung Galaxy S7, Android 7.1 API 25 it does not work.\r\ncould you please attach the app.js also ... maybe I'm doing something wrong", "updateAuthor": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-17T07:23:39.000+0000", "updated": "2019-09-17T07:23:39.000+0000" }, { "id": "451422", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~Claudiu Stefaniga]!\r\n*app.js*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#fff'\r\n});\r\n \r\nTitanium.Network.addEventListener('change', function(e)\r\n\r\n{ Ti.API.error('Network system state: ' + (Titanium.Network.online ? 'ONLINE' : 'OFFLINE')); Ti.API.error('Network event state: ' + (e.online ? 'ONLINE' : 'OFFLINE') + ' on ' + e.networkTypeName); }\r\n);\r\n \r\nwin.open();\r\n{code}\r\nThanks", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2019-09-17T07:57:52.000+0000", "updated": "2019-09-17T07:58:09.000+0000" }, { "id": "451471", "author": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "OK, I think I got it.\r\nwhen we turn of the WIFI and the android goes to Mobile data we receive actually 2 event\r\n[ERROR] : Network system state: OFFLINE\r\n[ERROR] : Network event state: OFFLINE on NONE\r\nand very soon after we receive\r\n[ERROR] : Network system state: ONLINE\r\n[ERROR] : Network event state: ONLINE on MOBILE\r\n\r\nMy problem was that in my genymotion simulator I did not receive the second event which put the network state to online on mobile. (if I use the emulators provided by Android Studio -> the events are there)\r\nAnd when testing on devices I actually checked the functionality (which throws and event when network changes and then consumes it in another part of the app, but that part of the app has a _debounce -> so it will ignore for 3 seconds other Network changes) \r\n\r\nthanks for the support", "updateAuthor": { "name": "Claudiu Stefaniga", "key": "claudiu stefaniga", "displayName": "cstefaniga ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-18T07:44:14.000+0000", "updated": "2019-09-18T07:44:14.000+0000" }, { "id": "452454", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~Claudiu Stefaniga], the reason you don't get the second event logged in the Genymotion emulator is that the emulators always use WIFI for connectivity from the PC. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-11-04T19:02:53.000+0000", "updated": "2019-11-04T19:02:53.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }