{ "id": "79201", "key": "TIMOB-4991", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "11365", "description": "Mobile 1.8.0 M12", "name": "Sprint 2011-33", "archived": true, "released": true, "releaseDate": "2011-08-22" }, { "id": "11971", "description": "iOS5 and select Android fixes", "name": "Release 1.7.3", "archived": true, "released": true, "releaseDate": "2011-10-18" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-08-26T16:12:04.000+0000", "created": "2011-08-12T15:11:34.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "module_other", "verified-1.7.3" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [ { "id": "12389", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "78597", "key": "MOD-157", "fields": { "summary": "Android Urban Airship 1.1 Force Close ", "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": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "12387", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "70657", "key": "TIMOB-4341", "fields": { "summary": "2nd instance of application run from a separate process causes NullPointerException", "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": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-02T08:25:39.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": "The Urban Airship module requires some specific initialization to occur during the onCreate method of the application object. Urban Airship starts a Push Service during the application initialization AND it also registers with the BOOT_COMPLETED intent so that it gets restarted on a system reboot. This second case causes an instance of the application to be created (without starting the main activity) and it is this process startup that requires the module to be able to set the configuration options. Failure to do this causes the Push Service to throw an exception and crash.\r\n\r\nI have defined a static method in the UA module called onAppStartup(). This static method needs to be called from the application's onCreate method. There have been a couple of ideas surrounding this. One that I have implemented and tested uses reflection to query if the custom module contains the onAppCreate method and invokes it if found. The current implementation does the reflection at run time -- it may be possible to do the reflection at build time and insert the code into the onCreate method only if needed.\r\n\r\nAnother proposed idea is to add an attribute to the tiModule.xml file to indicate that during the code generation phase it should insert a call to the module's onAppCreate method. It would then be required by the module developer to ensure that this method is implemented.\r\n\r\nAnother proposed idea is to expose a new annotation, something like @Ti.onAppCreate, that would used to identify a method to be called from the application's onCreate.\r\n\r\nThe requirement basically is to call a static method called 'onAppCreate' in the module if-and-only-if that method is defined in the module. The Urban Airship module has been updated to include this method.", "attachment": [ { "id": "22621", "filename": "androidModule.zip", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-20T14:59:09.000+0000", "size": 11687, "mimeType": "application/zip" }, { "id": "22554", "filename": "App.java", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2011-08-12T15:15:40.000+0000", "size": 2726, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: Call module's onAppCreate method as part of application's onCreate processing", "creator": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "162705", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "body": "The UA module now includes the onAppStart method", "updateAuthor": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2011-08-12T15:12:18.000+0000", "updated": "2011-08-12T15:12:18.000+0000" }, { "id": "162706", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "body": "Attached is a modified app.java file that uses reflection at run time to determine if it needs to call the onAppStart method in all custom modules. The generated file includes a try/catch block for each custom module. This method works, but we should try to find a more efficient means to do this.", "updateAuthor": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2011-08-12T15:15:40.000+0000", "updated": "2011-08-12T15:15:40.000+0000" }, { "id": "163561", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "To verify this fix:\r\n\r\n* Download and extract the attached module project\r\n* Make sure you have an emulator running, and run these commands inside the module directory:\r\n\r\n{code}\r\n$ ant\r\n$ ant run\r\n{code}\r\n\r\n(This will build the example project included in the module and deploy it to the emulator)\r\n\r\n* If the app says \"woohoo! custom onAppCreate called\", then you've verified the fix\r\n\r\nFor code review:\r\n\r\n* Take a look at {{src/com/arcaner/androidmodule/AndroidModule.java}}, and take notice of the {{@Kroll.onAppCreate}} annotation on {{customOnAppCreate}} (and that it sets a flag)\r\n* Take a look at {{example/app.js}} and notice that we switch on the boolean {{onAppCreateCalled()}} module method to control the label's message (this is set when {{customOnAppCreate}} is called).", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-20T14:58:25.000+0000", "updated": "2011-08-20T14:58:25.000+0000" }, { "id": "163572", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "body": "@Marshall\r\n\r\nPerformed functional test and it works for the UrbanAirship module. A couple of comments:\r\n1. I defined the parameter in my onAppCreate to be a TiApplication object rather than an Application object. Should the documentation and your example be changed to use TiApplication?\r\n2. The generated code contains a number of blank lines before the call to the custom onAppCreate method. Not something to worry about since it doesn't affect anything, just making a note.", "updateAuthor": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2011-08-21T12:50:02.000+0000", "updated": "2011-08-21T12:50:02.000+0000" }, { "id": "163573", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Jeff\r\n\r\n* You can actually use either class, but Application is probably safer for forward compatibility -- we can't guarantee APIs on TiApplication right now. Are you using any methods from TiApplication?\r\n* The blank lines come from iterating all of the modules inside the template -- I should be able to suppress them though. Thanks for the heads up", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-21T14:11:44.000+0000", "updated": "2011-08-21T14:11:44.000+0000" }, { "id": "163576", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "body": "@Marshall\r\n\r\n- Using the getProperties method (was calling TiApplication.getInstance().getAppProperties() but updated to use the Application object passed in on the onAppCreate method when I pulled your update). Since the onAppCreate is called from the onCreate method of the application class which extends TiApplication it should be okay, right?", "updateAuthor": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2011-08-21T14:35:16.000+0000", "updated": "2011-08-21T14:35:16.000+0000" }, { "id": "163578", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Jeff\r\n\r\nYeah, it should be fine. I'll update the docs to mention TiApplication", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-21T18:03:21.000+0000", "updated": "2011-08-21T18:03:21.000+0000" }, { "id": "163596", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Jeff\r\n\r\nMy latest changes are pushed with your suggestions. Would you mind commenting with your functional review status on the pull request?\r\nhttps://github.com/appcelerator/titanium_mobile/pull/397", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-22T01:46:06.000+0000", "updated": "2011-08-22T01:46:06.000+0000" }, { "id": "164216", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "Merged to master (with pull request) and 1_7_X (with hand merge). Tested 1_7_X hand merge by running several KS tests, drillbit and of course Marshall's test module/app in here.", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-08-26T16:12:04.000+0000", "updated": "2011-08-26T16:12:04.000+0000" }, { "id": "167528", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.7.3.v20110928185013 app says \"woohoo! custom onAppCreate called\"", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-30T18:16:58.000+0000", "updated": "2011-09-30T18:16:58.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }