Creating a shortcut on the Home screen

This recipe explains how to create a link or create a shortcut for your app on the user's Home screen. So as not to be too obtrusive, it's generally best to make this an option for the user to initiate, such as in the settings.

Here is a screenshot showing our shortcut on the Home screen:

Creating a shortcut on the Home screen

As you can see, this is just a shortcut, but we will explore creating a Home screen (AppWidget) in the next recipe.

Getting ready

Create a new project in Android Studio and call it: HomescreenShortcut. Use the default Phone & Tablet options and select the Empty Activity option when prompted for the Activity Type.

How to do it... ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.