MobileApplication.AddShortcut
From Xojo Documentation
Method
MobileApplication.AddShortcut(identifier as String, title as String, subtitle as String = "", iconName as String = "", userInfo as Dictionary = Nil)
New in 2020r2
Supported for all project types and targets.
New in 2020r2
Supported for all project types and targets.
Adds a shortcut to the app's shortcut menu.
Parameters
Name | Description |
---|---|
identifier | This should be a unique value that identifies the action the user is taking. It will be passed (along with the userInfo parameter below) to the HandleShortcut event when the user chooses this shortcut from the app's shortcut menu. |
title | The title of the shortcut item as it will appear in the shortcut menu. Remember to localize this for whichever languages into which you localize your app. |
subtitle | An additional line of text that appears below the title. |
iconName | The name of the icon that will appear with the text. If the name matches an Apple SF Symbol, that icon will appear. Otherwise, if it matches the name of a picture in your project or a picture file in the Resources folder of your app bundle, that picture will be used. |
userInfo | A Dictionary of information that will be passed to the HandleShortcut event when the user chooses this shortcut from the app's shortcut menu. |
Notes
The shortcut menu is accessed by the user performing a long-press on the application's icon.
If you're going to add shortcuts via code, you should add all of your shortcuts in the Opening event.
Shortcuts can also be added using the Xojo IDE's visual editor. Click on iOS under Build Settings in the Navigator, choose the Advanced tab and then click on the Options button next to Shortcut Items in the Inspector.
Sample Code
Var credentials As New Dictionary
d.Value("username") = user.Name
d.Value("passwordHash") = user.PasswordHash
App.AddShortcut("userlogin", "Login", "Connect to your account", "person-badge", credentials)
d.Value("username") = user.Name
d.Value("passwordHash") = user.PasswordHash
App.AddShortcut("userlogin", "Login", "Connect to your account", "person-badge", credentials)
See Also
HandleShortcut event, RemoveAllShortcuts method.