Project: titanium
Issue TIMOB-19679: Android: Added additional type support for IntentProxy
h6.Issue Description Currently 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: {code:javascript} var currentIntent = Ti.Android.currentActivity.getIntent(); currentIntent.setAction(Ti.Android.ACTION_MAIN); // Add custom metadata to read when your App is launched from the shortcut. currentIntent.putExtra("shortcut", "gallery"); // Create an Intent var shortcutIntent = Ti.Android.createIntent({ action: "com.android.launcher.action.INSTALL_SHORTCUT", }); // Title that will appear with the shortcut shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_NAME, "Gallery"); shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_INTENT, currentIntent); // Not currently possible shortcutIntent.putExtra("duplicate", false); // Set the icon for the shortcut var iconImage = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "appicon.png").read(); shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_ICON, iconImage); // Not currently possible // Adds the shortcut to the home screen. Ti.Android.currentActivity.sendBroadcast(shortcutIntent); {code} I have created a pull request that adds the missing input types. https://github.com/appcelerator/titanium_mobile/pull/7073
Story points: 2