{ "id": "141060", "key": "TIMOB-18147", "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": [], "resolution": null, "resolutiondate": null, "created": "2014-12-06T00:53:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "16676", "description": "Release 3.4.1", "name": "Release 3.4.1", "archived": false, "released": true, "releaseDate": "2014-11-14" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "issuelinks": [ { "id": "43754", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "141059", "key": "TIMOB-18146", "fields": { "summary": "Android: Cannot send Broadcast with data property defined in the intent", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-02-28T19:55:40.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "REPRODUCTION:\r\nRun the code below in the Genymotion emulator and click the \"Send Broadcast\" button.\r\n\r\nRESULTS:\r\nLogcat reports that the current activity is a BroadcastReceiver object.\r\n\r\n{noformat}\r\n[INFO] : hello?\r\n[INFO] : {\"bubbleParent\":true,\"url\":\"testintent.js\",\"apiName\":\"Ti.Android.BroadcastReceiver\"}\r\n[INFO] : {\"bubbleParent\":true,\"apiName\":\"Ti.Android.Activity\",\"actionBar\": \"bubbleParent\":true,\"apiName\":\"Ti.Android.ActionBar\",\"title\":null,\"navigationMode\":0,\"subtitle\":null}}\r\n{noformat}\r\n\r\nOTHER INFO:\r\nCan get current activity using `this.Ti.Android.currentActivity`\r\n\r\n*/Resources/app.js*\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nvar button = Ti.UI.createButton({\r\n\ttitle : 'Send Broadcast'\r\n});\r\nbutton.addEventListener('click', function() {\r\n\r\n\tvar intent = Ti.Android.createBroadcastIntent({\r\n\t\taction: 'com.appcelerator.action.ALERT'\r\n\t});\r\n\tTi.Android.currentActivity.sendBroadcast(intent);\r\n});\r\nwin.add(button);\r\nwin.open();\r\n\r\nvar broadcastReceiver = Ti.Android.createBroadcastReceiver({\r\n\turl: 'testintent.js'\r\n});\r\nTi.Android.registerBroadcastReceiver(broadcastReceiver, ['com.appcelerator.action.ALERT']);\r\n{code}\r\n\r\n*/Resources/testintent.js*\r\n{code}\r\nTi.API.info('hello?');\r\nTi.API.info(JSON.stringify(Ti.Android.currentActivity));\r\nTi.API.info(JSON.stringify(this.Ti.Android.currentActivity));\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: Cannot get current activity from JavaScript broadcast receiver", "creator": { "name": "bhatfield", "key": "bhatfield", "displayName": "Benjamin Hatfield", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bhatfield", "key": "bhatfield", "displayName": "Benjamin Hatfield", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS X 10.8.5\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nTiSDK 3.4.1.GA, 3.6.0.v20141125154117\r\nTi CLI 3.5.0-dev\r\nAndroid API level 21\r\nGenymotion Google Nexus 7 - 4.4.4 - API 19 - 800x1280", "comment": { "comments": [ { "id": "346988", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah] Thoughts on priority?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-03-23T15:34:04.000+0000", "updated": "2015-03-23T15:34:04.000+0000" }, { "id": "347081", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~ingo]\r\nIf there's a work around \"this.Ti.Android.currentActivity\" and there's not many watchers on this, I think the priority shouldn't be too high.\r\nInstead, maybe a note can be added to the docs for this about broadcast receiver and on the \"currentActivity\" docs.\r\n\r\nJust my 2 cents.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-03-24T02:29:31.000+0000", "updated": "2015-03-24T02:29:31.000+0000" }, { "id": "347094", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Okay, [~bhatfield] can you put your workaround in the docs for now?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-03-24T04:02:43.000+0000", "updated": "2015-03-24T04:02:43.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }