Created
May 18, 2012 03:39
-
-
Save gshackles/2723016 to your computer and use it in GitHub Desktop.
create a shortcut to the app on the homescreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; | |
[assembly: UsesPermission("com.android.launcher.permission.INSTALL_SHORTCUT")] | |
namespace AndroidApplication6 | |
{ | |
[Activity(Label = "AndroidApplication6", MainLauncher = true, Icon = "@drawable/icon")] | |
public class Activity1 : Activity | |
{ | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
var intent = new Intent(this, typeof(Activity1)); | |
var installer = new Intent(); | |
installer.PutExtra("android.intent.extra.shortcut.INTENT", intent); | |
installer.PutExtra("android.intent.extra.shortcut.NAME", "Start My App"); | |
installer.SetAction("com.android.launcher.action.INSTALL_SHORTCUT"); | |
SendBroadcast(installer); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment