{ "id": "116157", "key": "TIMOB-14291", "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": [], "resolution": null, "resolutiondate": null, "created": "2013-06-19T07:13:51.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "intent", "packagemanager" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" } ], "issuelinks": [ { "id": "57623", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "173605", "key": "TIMOB-27070", "fields": { "summary": "Android: Add canStartActivity() method to \"Ti.Android.Activity\"", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-05-08T21:07:33.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": "At the moment, there is no way to figure out which apps and intents is available on the users device. \r\n\r\nSo we need to guess, or do try catch logic, like this:\r\n\r\n{code:javascript} \r\ntry {\r\n\tvar intent = Ti.Android.createIntent({\r\n\t\taction : Ti.Android.ACTION_SEND,\r\n\t\tpackageName : \"com.twitter.android\",\r\n\t\tclassName : \"com.twitter.android.PostActivity\",\r\n\t\tflags : Ti.Android.FLAG_ACTIVITY_NEW_TASK,\r\n\t\ttype : \"text/plain\"\r\n\t});\r\n\t\r\n\tif (options.text) {\r\n\t\tintent.putExtra(Ti.Android.EXTRA_TEXT, options.text);\r\n\t}\r\n\tTi.Android.currentActivity.startActivity(intent);\r\n\r\n} catch(e){\r\n\t// Fallback - if app is not installed\r\n\t// do something\r\n}\r\n{code} \r\n\r\nWhat we need is access to Android Package Manager. This way we can loop through the installed applications, and figure out what is available, instead of guessing. \r\n\r\nI could do something like this: http://stackoverflow.com/questions/6827407/how-to-customize-share-intent-in-android/9229654#9229654\r\n\r\nProposal:\r\n{code:javascript}\r\n// test\r\nvar bool = Ti.Android.isPackageNameSupported(\"com.twitter.android\");\r\n\r\n// get all apps installed\r\nvar mainIntent = Ti.Android.createIntent({\r\n\taction : Ti.Android.ACTION_SEND\r\n});\r\nmainIntent.addCategory(Ti.Android.CATEGORY_LAUNCHER);\r\nvar packageManager = Ti.Android.getPackageManager();\r\nvar applist = packageManager.queryIntentActivities( mainIntent, 0);\r\n{code} \r\n", "attachment": [], "flagged": false, "summary": "Android: Support for PackageManager and queryIntentActivities", "creator": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Ti SDK 3.1.1.GA", "comment": { "comments": [ { "id": "258576", "author": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "body": "Priority: None\r\n\r\nnice one :) ", "updateAuthor": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-06-19T18:22:40.000+0000", "updated": "2013-06-19T18:22:40.000+0000" }, { "id": "260081", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You're welcome. :) I'll get the team to work on scoping this.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-28T21:19:49.000+0000", "updated": "2013-06-28T21:19:49.000+0000" }, { "id": "278008", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "I built a module that provides PackageManager access: https://github.com/iotashan/TiAppHelper", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-11-04T19:13:00.000+0000", "updated": "2013-11-04T19:13:00.000+0000" }, { "id": "369183", "author": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "body": "@Shannon Hicks: Can you please advice me how to install your module? It's JAR only file... \r\nThanks", "updateAuthor": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "created": "2015-11-06T12:49:09.000+0000", "updated": "2015-11-06T12:49:09.000+0000" }, { "id": "369184", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "You'll have to build that one from source.", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2015-11-06T13:34:09.000+0000", "updated": "2015-11-06T13:34:09.000+0000" }, { "id": "373655", "author": { "name": "underlabs", "key": "underlabs", "displayName": "Joseph Sachs", "active": true, "timeZone": "America/Montreal" }, "body": "I will try this out. Seems like 3 years old. Hope it's still working", "updateAuthor": { "name": "underlabs", "key": "underlabs", "displayName": "Joseph Sachs", "active": true, "timeZone": "America/Montreal" }, "created": "2015-12-31T04:46:42.000+0000", "updated": "2015-12-31T04:46:42.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }