Introduction
In this tutorial, we will learn how to create and use app shortcuts in the xamarin forms app using Xamarin Essentials - AppActions class lets you create and respond to app shortcuts from the app icon. This will allow to navigate to the corresponding page from the app icon.
Coding Part
Steps
- Step 1: Creating new Xamarin.Forms Projects
- Step 2: Setting up the App Actions in Android and iOS
- Step 3: Implementation of App Shortcuts in Xamarin Forms
Step 1: Creating new Xamarin.Forms Projects
Create New Project by selecting "New Project" Ă "Xamarin Cross Platform App"
and Clicking "OK".
Note: Xamarin.Forms version should be greater than 5.0.
Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.
Step 2: Setting up the App Actions in Android and iOS
- Add Intentfilter for App Action in your MainActivity.cs class. Refer to the below image.
- Then add the following logic to handle actions: iOS Setup
- In the AppDelegate.cs add the following logic to handle actions:
In this step, we will see how to setup the code for Android and iOS.
Android SetupStep 3: Implementation of App Shortcuts in Xamarin Forms
In this step, we will see how to implement the functionality in Xamarin.Forms.
Create App Actions in Xamarin.Forms- Id: A unique identifier used to respond to the action tap.
- Title: The visible title to display.
- Subtitle: If supported a sub-title to display under the title.
- Icon: Must match icons in the corresponding resources directory on each platform.
Follow Us
Were this world an endless plain, and by sailing eastward we could for ever reach new distances