Delpin Susai Raj Thursday 1 July 2021

Xamarin.Forms - App Shortcuts Using Xamarin.Essentials

In this blog post, you will learn how to add shortcuts using Xamarin.Essentials in Xamarin.Forms App

Introduction

Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

App Actions

Xamarin.Essentials provided one of the best API for App Actions, by clicking the App icon will display the menu option if choose the option app will be navigating the appropriate page or link.

Prerequisites

  • Visual Studio 2017 or later (Windows or Mac)
  • Xamarin.Essentials 1.6 or later

Setting up a Xamarin.Forms Project

Start by creating a new Xamarin.Forms project. You will learn more by going through the steps yourself.

Create a new or existing Xamarin forms(.Net standard) Project. With Android and iOS Platform. 

Install Xamarin.Essential Nuget

Note: Make sure you must install Xamarin.Essentials 1.6 or later.

In this step, add Xamarin.Essentials to your project. You can install Xamarin.Essentials via NuGet, or you can browse the source code on GitHub.
Go to Solution Explorer and select your solution. Right-click and select "Manage NuGet Packages for Solution". Search "Xamarin.Essentials" and add Package. Remember to install it for each project (PCL, Android, iO, and UWP). refer below image

Android Setup

Now, Add Intentfilter for App Action in your MainActivity.cs class. Refer to the below image.

MainActivity.cs 


iOS Setup

Add below code in AppDelegate.cs to handle App Action in your iOS app.

AppDelegate.cs

Add Shortcuts

Now add App shortcuts in your App.Xaml.cs class OnStart Method

The following properties you can be set on an AppAction:

  1. Id: A unique identifier used to respond to the action tap.
  2. Title: the visible title to display.
  3. Subtitle: If supported a sub-title to display under the title.
  4. Icon: Must match icons in the corresponding resources directory on each platform.

App.xaml.cs

Responding To Actions

Now, Register actions for shortcuts in App.xaml.cs constructor.

When an app action is selected the event will be sent with information as to which action was selected.

App.xaml.cs


FeatureNotSupportedException

If App Actions are not supported on the specific version of the operating system a FeatureNotSupportedException will be thrown. 

Full code

You will get the full source code here.

App.xaml.cs

Result

iOS Simulator

Android

Conclusion

I hope you have understood how to add shortcuts using Xamarin.Essentials in Xamarin.Forms App

References

https://docs.microsoft.com/en-us/xamarin/essentials/app-actions 

Thanks for reading. Please share your comments and feedback. Happy Coding :)

13 comments:

  1. Nice blog! I really loved reading through this Blog... Thanks for sharing such a very interesting post with us and keep blogging. Visit our website-
    Xamarin App Developers
    ABP .io Development company
    Web and App development company

    ReplyDelete
    Replies
    1. Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download Now

      >>>>> Download Full

      Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download LINK

      >>>>> Download Now

      Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download Full

      >>>>> Download LINK oK

      Delete
  2. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! odotlive

    ReplyDelete
  3. Such a great blog! I am looking for these kinds of blogs for last many days. Keep it up. Thanks for sharing it with us
    app and web development company
    Hire xamarin developer
    hire abp.io developers
    Hire dot net developers

    ReplyDelete
  4. I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. magento development company

    ReplyDelete

  5. Amazing Post, I Like your post if you want to aware of the stock market Get 90% accurate Share Tips| Indian Stock Tips | MCX Trading , F&O , Nifty Intraday Tips for daily Profit!!! For Free trial give a Missed Call at 083 0211 0055.

    ReplyDelete
  6. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site. For more info:- Xamarin App Development

    ReplyDelete
  7. I found your this post while searching for some related information on blog search...This is a wonderful post,.. keep posting and update the information. AT&T Software is one of the leading web and mobile app development company

    Hire Seo Expert

    ReplyDelete
  8. Thanks for sharing great information. Your website is very nice. The details on this blog are impressive What a great blog! Know How Much Does It Cost to Develop a Mobile App in 2021?

    ReplyDelete
  9. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... Ethereum Classic

    ReplyDelete
  10. Interesting and very well written article, Thanks for the great article.
    Natural Henna

    ReplyDelete
  11. Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download Now

    >>>>> Download Full

    Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download LINK

    >>>>> Download Now

    Xamarin Monkeys: Xamarin.Forms - App Shortcuts Using Xamarin.Essentials >>>>> Download Full

    >>>>> Download LINK Xb

    ReplyDelete
  12. Hello, thank you for the information. I have been able to obtain new information here. However, I use this page to specialize in some technical problems. I have reloaded the page many times, so I was able to load it correctly. I wonder if your web host was OK.안산출장샵
    용인출장샵
    가평출장샵
    이천출장샵
    일산출장샵
    파주출장샵
    평택출장샵
    화성출장샵

    ReplyDelete