Hi guys,
I stuck a comment on here, but after thought, it probably is best to create my own thread rather than "hijacking".
This is the code I used.
private void AddShortcut()
{
var shortcutIntent = new Intent(this, typeof (ViewWebsiteApp));
shortcutIntent.PutExtra ("WebsiteID", website.ID);
shortcutIntent.SetAction(Intent.ActionMain);
var iconResource = Intent.ShortcutIconResource.FromContext(
this, Resource.Drawable.Icon);
var intent = new Intent();
intent.PutExtra(Intent.ExtraShortcutIntent, shortcutIntent);
intent.PutExtra(Intent.ExtraShortcutName, website.Name);
intent.PutExtra(Intent.ExtraShortcutIconResource, iconResource);
intent.PutExtra ("duplicate", false);
intent.SetAction("com.android.launcher.action.INSTALL_SHORTCUT");
SendBroadcast(intent);
}
private void RemoveShortcut()
{
var shortcutIntent = new Intent(this, typeof (ViewWebsiteApp));
shortcutIntent.SetAction(Intent.ActionMain);
var intent = new Intent();
intent.PutExtra(Intent.ExtraShortcutIntent, shortcutIntent);
intent.PutExtra(Intent.ExtraShortcutName, website.Name);
intent.SetAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
SendBroadcast(intent);
}
Now, I have read some things about using manifext.xml, however with not necessarily fully understanding what I am doing... I have been doing it wrong and going around in circles.
So, I have successfully managed to create the shortcut, it just doesn't launch the application, nevermind the specific activity I need it to open!
Any help would be appreciated!