Setup
https://assetstore.unity.com/packages/tools/integration/shortcuts-manager-for-android-191767
Add Shortcut
public const string OPEN_SCREEN = "screen_to_be_opened";
public void AddProfileShortcut () {
// Instance of UnityPlayerActivity
var activity = ShortcutsManager.Instance.GetCurrentAndroidActivity ();
// The actual Shortcut object
var profileShortcut = new Shortcut (
"user_profile_id", // shortcut id
"Profile", // shortcut short label
"Open profile and update your statistics!", // shortcut long label
"account_box", // icon name
0 // rank / order
);
// Intent object which will be 'executed' when
// the user click on the shortcut
var profileIntent = new Intent ()
// Set intent action.
.SetAction (IntentActions.ACTION_VIEW)
// Set intent class name.
.SetClassName (activity, ShortcutsManager.UNITY_PLAYER_ACTIVITY)
// Set intent flags
.SetFlags (IntentFlags.FLAG_ACTIVITY_SINGLE_TOP)
// Put int extra to the intent in order to be able
// to detect which screen we should open when the user
// clicks the shortcut.
.PutExtra (OPEN_SCREEN, (int) Screens.PROFILE);
// Tell the ShortcutManager to add the shortcut with
// the intent which should be executed when the shortcut
// is clicked.
ShortcutsManager.Instance.AddDynamicShortcut (
profileShortcut,
profileIntent
);
}Update Shortcut
Remove Shortcut
Pin Shortcut
Last updated