{ "id": "134189", "key": "TIMOB-17747", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" } ], "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2015-06-17T02:59:39.000+0000", "created": "2014-08-05T18:32:19.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "TCSupport" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "43939", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "120982", "key": "TIMOB-15443", "fields": { "summary": "Android: Allow full Activity lifecycle access for Titanium modules", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-16T21:42:48.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4. Problem Description\r\nI have created a native module that has some code in an {{onStart()}} method - when importing this module in my alloy controller using {{require()}}, the {{onStart()}} method is called when the root activity is started when using Titanium SDK 3.2.3.GA, but when using 3.3.0, it is never called.\r\n\r\nI have properly declared the module in my {{tiapp.xml}} and my {{onStart()}} method is pretty simple:\r\n\r\n{noformat}\r\n\t@Override\r\n\tpublic void onStart(Activity activity)\r\n\t{\r\n\t\t// This method is called when the module is loaded and the root context is started\r\n\r\n\t\tLog.d(TAG, \"[MODULE LIFECYCLE EVENT] start\");\r\n\t\tsuper.onStart(activity);\r\n\t}\r\n{noformat}\r\n\r\nIn 3.2.3.GA I see the debug message in the {{logcat}} output - but using 3.3.0.GA I never see it (however I do see the {{onPause}} and {{onStop}} lifecycle methods are properly called.\r\n\r\nMy native module depends on some initialization code in {{onStart}} that cannot be moved to {{onAppCreate}}, so it's currently failing as {{onStart}} is never called (nor is {{onPause}} which is a bit suspect).\r\n\r\nAlso, for a non-Alloy app, this does not happen -- all of the lifecycle methods, including {{onStart}} are called as expected.\r\n\r\n\r\nh4. Steps to reproduce.\r\n1. Download the module from this [link|https://github.com/jamesfalkner/liferay-android-beacons/blob/master/dist/com.liferay.beacons-android-0.1.zip]\r\n2. Create a titanium classic project\r\n3. Paste this code:\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:'white'\r\n});\r\nvar label = Ti.UI.createLabel();\r\nwin.add(label);\r\nwin.open();\r\n \r\nif (Ti.Platform.name == \"android\") {\r\n var mod = require('com.liferay.beacons');\r\n label.text = \"module is => \" + mod + \"and checkAvailability says: \" + mod.checkAvailability();\r\n} else {\r\n label.text = \"liferay.beacons not supported on \" + Ti.Platform.name;\r\n}\r\n{code}\r\n\r\n\r\nh4. Steps to reproduce the issue with alloy (which is easier to reproduce)\r\n1. Create a new alloy project\r\n2. Paste this to index.js:\r\n{code}\r\nvar mod = require('com.liferay.beacons');\r\n$.label.text= \"module is => \" + mod + \"and checkAvailability says: \" + mod.checkAvailability();\r\nfunction doClick(e) {\r\n alert($.label.text);\r\n}\r\n \r\n$.index.open();\r\n{code}\r\n3. Run it in a device. \r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: Native module onStart() lifecycle method never called for Alloy project", "creator": { "name": "james.falkner", "key": "james.falkner", "displayName": "James Falkner", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "james.falkner", "key": "james.falkner", "displayName": "James Falkner", "active": true, "timeZone": "America/New_York" }, "environment": "Titanium SDK 3.3.0.GA\r\nCLI version 3.3.0, \r\nTitanium SDK version 3.2.3.GA, 3.3.0.GA\r\nAndroid Device, Nexus 5 -Android 4.2 and Emulator.\r\nMac OS\r\n", "closedSprints": [ { "id": 416, "state": "closed", "name": "2015 Sprint 12 SDK", "startDate": "2015-06-06T00:00:43.862Z", "endDate": "2015-06-20T00:00:00.000Z", "completeDate": "2015-06-23T05:41:35.834Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "317838", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello,\r\njust to summarize (and correct me if I'm wrong):\r\n\r\nThe onStart works: \r\n\r\n3.2.3+Classic - OK\r\n3.2.3+Alloy - OK\r\n3.3.0+Classic - OK\r\n3.3.0+Alloy - FAIL.\r\n\r\nDo you agree?\r\n\r\nBest Regards", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-10T07:24:38.000+0000", "updated": "2014-08-10T07:24:38.000+0000" }, { "id": "317876", "author": { "name": "james.falkner", "key": "james.falkner", "displayName": "James Falkner", "active": true, "timeZone": "America/New_York" }, "body": "Yep, that's right :) ", "updateAuthor": { "name": "james.falkner", "key": "james.falkner", "displayName": "James Falkner", "active": true, "timeZone": "America/New_York" }, "created": "2014-08-10T16:29:27.000+0000", "updated": "2014-08-11T18:53:20.000+0000" }, { "id": "321138", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We've observed the same thing with \"Classic\" projects and 3.3.0 - it depends on the complexity of app.js, which modules are loaded, etc.\r\nIf I take one of our apps, and strip it down to the basics, I can get the onStart event.\r\nIf I add everything back plus modules, I don't.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-30T00:44:27.000+0000", "updated": "2014-08-30T00:44:27.000+0000" }, { "id": "321139", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Likewise with onCreate if you're looking for that event. Used to get it in 3.2.x SDK, not in 3.3.0.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-30T00:46:20.000+0000", "updated": "2014-08-30T00:46:20.000+0000" }, { "id": "335723", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-12-09T22:46:02.000+0000", "updated": "2014-12-09T22:54:28.000+0000" }, { "id": "354856", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-06-11T07:44:00.000+0000", "updated": "2015-06-11T07:44:00.000+0000" }, { "id": "355307", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "To create a module that hooks to the lifecycle, take a look at here: https://github.com/appcelerator-modules/ti.facebook/blob/master/android/src/facebook/ActivityWorkerProxy.java\r\n\r\nAnd create the proxy as mentioned {code}win1.fbProxy = fb.createActivityWorker({lifecycleContainer: win1});{code}\r\n\r\nHopefully this no longer is an issue and I'll close this as resolved. If this is still posing a problem, do comment.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-06-17T02:58:00.000+0000", "updated": "2015-06-17T02:58:00.000+0000" }, { "id": "413163", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Can confirm that this was done.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-16T21:42:48.000+0000", "updated": "2017-03-16T21:42:48.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }