{ "id": "151730", "key": "TIMOB-19679", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-12-03T03:47:42.000+0000", "created": "2015-10-05T18:52:39.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "andoid", "intent", "module_android", "notable", "qe-manualtest", "qe-testadded", "shortcut" ], "versions": [], "issuelinks": [ { "id": "50695", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "155125", "key": "TIMOB-20459", "fields": { "summary": "Android newintent event not fired", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-02-25T09:27:35.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": "h6.Issue Description\r\nCurrently it is not possible to create a launcher shortcut programmatically using the Titanium platform. Titanium allows for the creation of an Android intent using Ti.Android.createIntent but the implementation of the putExtra method is incomplete. It currently only supports Java primitives. Creating a shortcut requires an intent and an image to be set. Ideally the following example should work:\r\n\r\n{code:javascript}\r\nvar currentIntent = Ti.Android.currentActivity.getIntent();\r\ncurrentIntent.setAction(Ti.Android.ACTION_MAIN);\r\n\r\n// Add custom metadata to read when your App is launched from the shortcut.\r\ncurrentIntent.putExtra(\"shortcut\", \"gallery\");\r\n\r\n// Create an Intent\r\nvar shortcutIntent = Ti.Android.createIntent({\r\n action: \"com.android.launcher.action.INSTALL_SHORTCUT\",\r\n});\r\n\r\n// Title that will appear with the shortcut\r\nshortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_NAME, \"Gallery\");\r\n\r\nshortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_INTENT, currentIntent); // Not currently possible\r\nshortcutIntent.putExtra(\"duplicate\", false);\r\n\r\n// Set the icon for the shortcut\r\nvar iconImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"appicon.png\").read();\r\nshortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_ICON, iconImage); // Not currently possible\r\n\r\n// Adds the shortcut to the home screen.\r\nTi.Android.currentActivity.sendBroadcast(shortcutIntent);\r\n{code}\r\n\r\nI have created a pull request that adds the missing input types.\r\nhttps://github.com/appcelerator/titanium_mobile/pull/7073", "attachment": [], "flagged": false, "summary": "Android: Added additional type support for IntentProxy", "creator": { "name": "CollinPrice", "key": "collinprice", "displayName": "Collin Price", "active": true, "timeZone": "America/Toronto" }, "subtasks": [], "reporter": { "name": "CollinPrice", "key": "collinprice", "displayName": "Collin Price", "active": true, "timeZone": "America/Toronto" }, "environment": null, "closedSprints": [ { "id": 529, "state": "closed", "name": "2015 Sprint 24 SDK", "startDate": "2015-11-21T01:30:12.670Z", "endDate": "2015-12-05T01:30:00.000Z", "completeDate": "2015-12-07T03:57:17.094Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "372010", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "This PR https://github.com/appcelerator/titanium_mobile/pull/7073 introduces a new feature to pass in an Intent and an Image.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-12-03T03:43:34.000+0000", "updated": "2015-12-03T03:47:19.000+0000" }, { "id": "372011", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR reviewed, tested and merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-12-03T03:48:09.000+0000", "updated": "2015-12-03T03:48:09.000+0000" }, { "id": "375653", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the implementation.\r\n\r\nNow \"putExtra\" supports images as well.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.5.0.201601262138\r\nTi SDK : 5.2.0.v20160131224748\r\nTi CLI : 5.0.6\r\nAlloy : 1.7.33\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.3-1\r\nAppc CLI : 5.2.0-238\r\nNode: 4.2.2\r\nNexus 5 - Android 5.1.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-01T22:57:58.000+0000", "updated": "2016-02-01T22:57:58.000+0000" }, { "id": "377634", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~msamah] [~lchoudhary] I try to add this to the 5.2 sample but the code in the description doesn't add an additional launcher shortcut for me (Android 6.0 device, 5.2.0.GA).", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-23T10:45:04.000+0000", "updated": "2016-02-23T10:45:04.000+0000" }, { "id": "377650", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~fokkezb], I had to use this permission in tiapp.xml for the launcher shortcut to get added :\r\n{code}\r\n\r\n{code}\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-23T16:49:26.000+0000", "updated": "2016-02-23T16:49:26.000+0000" }, { "id": "377754", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks [~lchoudhary], I got it to work. I also found it's better to use {{Ti.App.Android.launchIntent}} then {{Ti.Android.currentActivity.getIntent()}} since the last one will not be useful if the primary window is no longer the current one.\r\n\r\nWhen the app starts I can use {{Ti.App.Android.launchIntent.getStringExtra()}} to see if the shortcut was used to launch it. However, if the app is already running the {{newintent}} event on either {{Ti.Android.currentActivity}} or the current Window/TabGroup's activity doesn't fire. Any idea?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-24T10:17:20.000+0000", "updated": "2016-02-24T10:17:20.000+0000" }, { "id": "377767", "author": { "name": "CollinPrice", "key": "collinprice", "displayName": "Collin Price", "active": true, "timeZone": "America/Toronto" }, "body": "@fokkezb I actually had to abandon the launcher shortcut because I could not get {{newintent}} working. I figured it was related to the launcher shortcut but maybe this event is broken?", "updateAuthor": { "name": "CollinPrice", "key": "collinprice", "displayName": "Collin Price", "active": true, "timeZone": "America/Toronto" }, "created": "2016-02-24T14:06:54.000+0000", "updated": "2016-02-24T14:06:54.000+0000" }, { "id": "377859", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "It looks like it. I'll open a ticket.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-25T09:10:29.000+0000", "updated": "2016-02-25T09:10:29.000+0000" }, { "id": "377862", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Here it is: TIMOB-20459", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-25T09:27:35.000+0000", "updated": "2016-02-25T09:27:35.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }