{ "id": "173067", "key": "AC-6151", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2019-02-26T21:55:54.000+0000", "created": "2019-02-26T20:46:37.000+0000", "labels": [ "7.5.0.GA", "android", "run-on-main-thread" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-02-27T21:53:25.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": [], "description": "Build this app onto an android device. Connect a bluetooth keyboard. Open the app. Press the blue button a few times. Disconnect the scanner while the app is counting. The app resets and picks back up where it left off.\r\n\r\n\r\nI did notice that on 7.5.0 run-on-main-thread = false when the scanner disconnects it calls:\r\ndestroy\r\nstop\r\nwindow open\r\nstart\r\nresume\r\n\r\nwhen run-on-main-thread = true it only runs:\r\nwindow open\r\nstart\r\nresume\r\n\r\nShould it not still be running destroy and stop when run-on-main-thread = true?", "attachment": [ { "id": "66194", "filename": "alloy.js", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:19.000+0000", "size": 1696, "mimeType": "text/javascript" }, { "id": "66192", "filename": "app.tss", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:19.000+0000", "size": 780, "mimeType": "application/octet-stream" }, { "id": "66201", "filename": "index.js", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-27T21:53:21.000+0000", "size": 1831, "mimeType": "text/javascript" }, { "id": "66193", "filename": "index.js", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:19.000+0000", "size": 2640, "mimeType": "text/javascript" }, { "id": "66191", "filename": "index.tss", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:19.000+0000", "size": 155, "mimeType": "application/octet-stream" }, { "id": "66202", "filename": "index.xml", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-27T21:53:21.000+0000", "size": 368, "mimeType": "text/xml" }, { "id": "66190", "filename": "index.xml", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:19.000+0000", "size": 386, "mimeType": "text/xml" }, { "id": "66189", "filename": "tiapp.xml", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T20:45:43.000+0000", "size": 3863, "mimeType": "text/xml" } ], "flagged": false, "summary": "[Android] Run on main thread = true not firing Destroy and Stop Events", "creator": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android\r\nTitanium 7.5.0\r\nRun-on-main-thread = true", "comment": { "comments": [ { "id": "446334", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~josh.mocek], You were in touch with our team on the same issue in another ticket AC-5929. Please do not create a separate ticket of the same issue. Please post your comment in that ticket. Closing this. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-02-26T21:55:29.000+0000", "updated": "2019-02-26T21:55:29.000+0000" }, { "id": "446341", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This specific issue that [~josh.mocek] has brought up is a duplicate of [TIMOB-26850]", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T23:13:41.000+0000", "updated": "2019-02-26T23:13:41.000+0000" }, { "id": "446342", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is also only an issue with the 1st activity window when backing out of the app.\r\n\r\nI recommend that you use the {{Ti.UI.Window}} object's \"close\" event instead. Especially since it work on both Android and iOS.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-26T23:15:23.000+0000", "updated": "2019-02-26T23:15:23.000+0000" }, { "id": "446347", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~josh.mocek],\r\n\r\nAdmittedly there is a design issue here on Titaniums' end. Titanium's activity callbacks ({{onCreate}}, {{onStart}}, {{onDestroy}}, etc.) *+need+* to be synchronous. They need to be invoked as soon as the equivalent Java methods are invoked. Especially for {{onDestroy}} on the last activity window, because the app is about to exit. Currently, when \"run-on-main-thread\" is set to {{true}}, they are queued to be invoked after their equivalent Java method has been called, which has a short delay.\r\n\r\nIf we change these callbacks to be synchronous, then this will cause a breaking-change where you can no longer set up your callbacks from the {{Ti.UI.Window}} \"open\" event listener anymore, because that event gets fired after the Java {{onCreate()}}, {{onStart()}}, and {{onResume()}} methods get called on startup. But that said, there is an easy backward compatible solution to this. You would need to set up your callback before calling {{Window.open()}}.\r\n\r\nFor example:\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nwindow.activity.onCreate = function() {\r\n\tTi.API.info(\"### Activity.onCreate() called.\");\r\n};\r\nwindow.open();\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-27T03:36:56.000+0000", "updated": "2019-02-27T03:36:56.000+0000" }, { "id": "446375", "author": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Unfortunately the scanner disconnect does not call the onClose event. Here is the cleaned up file I was testing with. [^index.js] [^index.xml] ", "updateAuthor": { "name": "josh.mocek", "key": "josh.mocek", "displayName": "josh.mocek", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-27T21:53:25.000+0000", "updated": "2019-02-27T21:53:25.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }