{ "id": "98226", "key": "TIMOB-10214", "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": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14813", "description": "2013 Sprint 03", "name": "2013 Sprint 03", "archived": true, "released": true, "releaseDate": "2013-02-11" }, { "id": "15275", "description": "2013 Sprint 04 Core", "name": "2013 Sprint 04 Core", "archived": true, "released": true, "releaseDate": "2013-02-25" }, { "id": "14814", "description": "2013 Sprint 04", "name": "2013 Sprint 04", "archived": true, "released": true, "releaseDate": "2013-02-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-02-12T18:51:50.000+0000", "created": "2012-07-27T14:00:40.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "core", "module_api", "qe-testadded" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-10-23T23:15:37.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": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "In order to complete this project for the customer we need the receiver API exposed in Titanium - http://developer.android.com/guide/topics/manifest/receiver-element.html\r\n\r\nUse case: We need to use the broadcast / receiver API to launch a transparent activity that sits on top of the phone app when a phone call is received and during the call. Josh has some more details and a sample native app.", "attachment": [], "flagged": false, "summary": "TiAPI: Expose broadcast receiver API", "creator": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "environment": null, "comment": { "comments": [ { "id": "213961", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This feature request has been put on a low priority list following the discussion with services team.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-12T15:13:01.000+0000", "updated": "2012-08-12T15:13:01.000+0000" }, { "id": "213996", "author": { "name": "brianknorr", "key": "brianknorr", "displayName": "Brian Knorr", "active": true, "timeZone": "America/Chicago" }, "body": "Why?", "updateAuthor": { "name": "brianknorr", "key": "brianknorr", "displayName": "Brian Knorr", "active": true, "timeZone": "America/Chicago" }, "created": "2012-08-13T07:40:47.000+0000", "updated": "2012-08-13T07:40:47.000+0000" }, { "id": "226162", "author": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "body": "See my example native code in TIMOB-10066.", "updateAuthor": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-05T18:55:37.000+0000", "updated": "2012-11-05T18:55:37.000+0000" }, { "id": "233045", "author": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The goal stated here is to be able to have JS code that is executed by\na broadcast receiver. The broadcast receiver is registered in \nAndroidManifest.xml for the application. For example:\n\n\n \n ...\n \n \n \n \n \n \n\nThat declaration causes the onReceive() method in the TiBroadcastReceiver class to\nbe invoked each time phone state changes. The idea is to have that Java method\nbring up Kroll and then run some JS code, just as an app starts in Titanium today.\nSo a broadcast receiver looks like this:\n\npackage com.titanium.broadcastreciever;\n\nimport android.content.BroadcastReceiver;\nimport android.content.ComponentName;\nimport android.content.Context;\nimport android.content.Intent;\n\n\n\nclass TiBroadcastReceiver extends BroadcastReceiver {\n\n\t@Override\n\tpublic void onReceive(Context context, Intent intent) {\n \n // Take some action -- start a service or app, or\n // send a message to a service or app.\n\t\t\n\t}\n\t\n}\n\nThe usage pattern for Broadcast Receivers is generally that the method invoked \ndoes something fairly short and then exits. This action could be one of the \nfollowing things:\n\n(1) Start an Android service.\n(2) Send a message to an Android app or service.\n(3) Start an Android app. Note that this could lead to unexpected behavior for the\n user.\n\nRight now in Titanium, there isn't any way for a Broadcast Receiver to directly do\n(1) for a Titanium service. Titanium services can only be started in the context\nof a Titanium app that is already running. ", "updateAuthor": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-03T11:30:20.000+0000", "updated": "2013-01-03T11:30:20.000+0000" }, { "id": "236806", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test case:\r\n\r\n1. Run a titanium app with the following code snippet\r\n\r\napp.js\r\n{code:title=app.js|borderStyle=solid}\r\nvar win = Ti.UI.createWindow({\r\n\tfullscreen: false,\r\n\tbackgroundColor: 'blue'\r\n})\r\n\r\nvar bc = Ti.Android.createBroadcastReceiver({\r\n\turl:'mybroadcast.js'\r\n});\r\n\r\nvar register = Ti.UI.createButton({\r\n\ttop:10,\r\n\ttitle: 'register broadcast receiver'\r\n});\r\n\r\nvar unregister = Ti.UI.createButton({\r\n\ttitle: 'unregister broadcast receiver'\r\n});\r\n\r\nregister.addEventListener('click', function(){\r\n\tTi.Android.registerBroadcastReceiver(bc, [Ti.Android.ACTION_AIRPLANE_MODE_CHANGED]);\r\n\tTi.API.info('-------registered broadcast receiver');\r\n});\r\n\r\nunregister.addEventListener('click', function(){\r\n\tTi.Android.unregisterBroadcastReceiver(bc);\r\n\tTi.API.info('-------unregistered broadcast receiver');\r\n});\r\n\r\nwin.add(register);\r\nwin.add(unregister);\r\n\r\nwin.open();\r\n{code}\r\n\r\nmybroadcast.js\r\n{code}\r\nTitanium.API.info(\"---------------- Hello World! I am a broadcast \");\r\n{code}\r\n\r\n2. Click on 'register broadcast receiver'\r\n3. Toggle airplane mode and you should see the hello world message print out.\r\n_______________________________________________________________________________\r\n\r\n4. click on 'unregister broadcast receiver'\r\n5. Toggle airplane mode, and you should NOT see the hello world message.\r\n\r\n______________________________________________________________________________\r\n\r\n6. Click on 'register broadcast receiver'\r\n7. Back out of the app\r\n8. Toggle airplane mode again, and you should see the hello world message\r\n\r\n_______________________________________________________________________________\r\n\r\n9. Change the create broadcast call to use the onReceive property and run through steps 1-8 again.\r\n\r\n{code}\r\nvar bc = Ti.Android.createBroadcastReceiver({\r\n\tonReceived: function() {\r\n\t\tTitanium.API.info(\"---------------- Hello World! I am a broadcast \");\r\n\t}\r\n});\r\n{code}", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-31T22:25:29.000+0000", "updated": "2013-02-01T18:25:48.000+0000" }, { "id": "236917", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/3837", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-01T18:52:28.000+0000", "updated": "2013-02-01T18:52:28.000+0000" }, { "id": "238115", "author": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "body": "Hi,\r\n\r\nTrying to use this to receive the android.intent.action.BOOT_COMPLETED into a Titanium App (To then start a small service).\r\n\r\nIs this possible... struggling to get it working.\r\n\r\nThanks!", "updateAuthor": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "created": "2013-02-12T15:37:28.000+0000", "updated": "2013-02-12T15:37:28.000+0000" }, { "id": "243355", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with: \r\nSDK:3.1.0.v20130319222852\r\nStudio: 3.1.0.201303091040\r\nDevice: Samsung galaxy note(v 2.3.6)\r\n\r\nWorks as expected", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T06:21:33.000+0000", "updated": "2013-03-21T06:21:33.000+0000" }, { "id": "244106", "author": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "body": "Hi - did you get this to work with the BOOT_COMPLETED event?\r\n\r\nIf so, are you able to share any example code?\r\n\r\nThanks!", "updateAuthor": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "created": "2013-03-26T13:10:57.000+0000", "updated": "2013-03-26T13:10:57.000+0000" }, { "id": "244120", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "BOOT_COMPLETED probably won't work with this API since you need the app to be launched first to register the broadcast event. You may have to write a module to hook up the BOOT_COMPLETED broadcast intent.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-26T16:35:54.000+0000", "updated": "2013-03-26T16:35:54.000+0000" }, { "id": "244292", "author": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "body": "Thanks - we will be having the App launch first before we need it to accept the BOOT_COMPLETED event. So we don't want that event if the user has never opened the App.\r\n\r\nDoes that make sense?\r\n\r\nThanks!", "updateAuthor": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "created": "2013-03-27T15:14:57.000+0000", "updated": "2013-03-27T15:14:57.000+0000" }, { "id": "244900", "author": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You might want to see if this module can assist you with your requirement. If not you can always fork and make adjustments as needed.\n\nhttps://github.com/benbahrenburg/benCoding.Android.Tools/blob/master/documentation/bootreceiver.md", "updateAuthor": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-01T15:47:01.000+0000", "updated": "2013-04-01T15:47:01.000+0000" }, { "id": "245152", "author": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "body": "Thanks Ben - that looks just right!", "updateAuthor": { "name": "djf", "key": "djf", "displayName": "DJ", "active": true, "timeZone": "Europe/London" }, "created": "2013-04-02T08:03:53.000+0000", "updated": "2013-04-02T08:03:53.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }