App Shortcut on Android devices | Implementing App Shortcuts
  • Services
    Close
      • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal Development
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
      • Cloud and Infrastructure Management
      • Cloud Infra & Management Services
      • Remote Infra Management Services
      • DHIS2 Cloud Hosting Services
      • Consulting Services
      • UX & UI Consulting Services
      • Architectural Consulting Services
      • Performance Tuning & Assessment
      • Liferay Consulting Services
      • DevOps Consulting Services
      • Software Testing Services
      • Software Testing Services
      • Custom Application Development
      • Single Page Application Development
      • Mobile App Development
      • Android Application Development
      • iOS App Development
    Close
  • Solutions
    Close
      • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Human Resource Management System
      • Hospital Management System
      • Learning Management System
      • Community Portal Development
      • Partner Portal Development
      • Liferay Enterprise Solutions
      • Liferay Portal Development
      • Liferay Migration and Upgrade Services
      • Liferay Consulting Services
      • Liferay Performance Tuning
      • Enterprise Mobility Solutions
      • Network Monitoring Solutions
    Close
  • Products
    Close
      • HRMS
      • Commercium
    Close
  • Resources
    Close
      • Blogs
      • News
      • Events
      • Case Studies
      • White Papers
      • Books
    Close
  • Portfolio
  • en EN
    ar ARnl DUen ENfr FRid INms MAru RS
Inquire Now
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Inquire Now
en EN
ar ARnl DUen ENfr FRid INms MAru RS
  • Home
  • Services
    • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
    • Cloud and Infrastructure Management
      • Cloud Infrastructure Management Services
      • Remote Infrastructure Management Services
      • Cloud Hosting Services DHIS2
    • Quality Assurance
      • Software Testing Services
    • Custom Application Development
      • Single Page Application Development
    • Mobile App Development
      • Android Application Development
      • iOS App Development
  • Consulting
    • UX & UI Consulting
    • Architectural Consulting Services
    • Performance Tuning & Assessment
    • Liferay Consulting Services
    • DevOps Consulting Services
  • Solutions
    • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Hospital Management System
      • Learning Management System
      • Human Resource Management System
      • Community Portal Development
      • Partner Portal Development
    • Enterprise Mobility Solutions
    • Network Monitoring Solutions
  • Products
  • Technologies
  • Resources
    • Case Studies
    • Blogs
    • White Papers
  • Company
    • Who We Are
    • Career
    • Partners
    • News & Events
  • Contact
  1. >
  2. Mobile Application, Technologies
  3. >
  4. App Shortcut on Android devices
940 Share
1
1
0
1
0
Android App Development
940 Share
1
1
0
1
0

App Shortcut on Android devices

Recently Google has brought update to their latest Android system Nougat with the version 7.1 (API 25). It is a major release for Android developers to bundle multiple items under the hood with interesting functionalities. It will simplify user’s experience with a latest feature called “App Shortcuts”.

This post explores what is an App Shortcut and how you can use it with a small example..

What is an App Shortcut?

An App shortcut in Android Nougat is assimilar to 3D touch in iOS and allows display of any app’s most common actions or tasks on the user’s home screen. Users can add/modify/delete shortcuts by a long press on the app icon. It allows you to drag and rearrange app icons and create shortcut for app features in launcher menu. It allows you to publish five shortcuts which can be a combination of ‘Static’ and ‘Dynamic’ shortcuts.
  1. Static App Shortcuts: They are defined the resource file of an app’s APK and remain constant throughout the application.Static shortcuts are immutable which means that you must wait until you update your entire app to change the details of these static shortcuts.
    • Why use Static App shortcut:

      Static shortcuts are used for generic actions of the app that remains persistent until you update your app.

  2. Dynamic App Shortcuts: Dynamic shortcuts are created at runtime of your app. You can publish, update, and remove these shortcuts as you use these applications. It uses ShortcutManager API.
    • Why use Dynamic App shortcut:

      Dynamic shortcuts are used to provide specific actions within your app that could be changed based on user’s interaction within the app.

Implementing App Shortcuts

Static Shortcuts

To create a static shortcut,
1. Add a meta-data tag to your launcher Activity in the manifest and provide the shortcuts resource file.

 <meta-data
	android:name="android.app.shortcuts"
	android:resource="@xml/shortcuts" /> 

2. Create a new resource file: res/xml/shortcuts.xml.
3. This is where we will specify all shortcuts that your app can support.
4. Each element contains information about a static shortcut, including its icon, its description labels, and the intents that it launches within the app.

 <shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:icon="@drawable/add_event"
android:shortcutId="shortcut_add_events"
android:shortcutLongLabel="@string/app_shortcut_longLabel_view_events"
android:shortcutShortLabel="@string/app_shortcut_shortLabel_view_events"
>
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.knowarth.appshortcutdemo.AddEvents"
android:targetPackage="com.knowarth.appshortcutdemo" ></intent>
</shortcut>
</shortcuts> 

These are very easy steps to implement. However, you may notice that as you press the Back button on your phone, you will be taken to the Home Screen.
Now, if you want to to navigate it within your app then we can add multiple intent tags under the shortcut once we previously created.

 <shortcut
android:icon="@drawable/add_event"
android:shortcutId="shortcut_add_events"
android:shortcutLongLabel="@string/app_shortcut_longLabel_view_events"
android:shortcutShortLabel="@string/app_shortcut_shortLabel_view_events"
>
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.knowarth.appshortcutdemo"
android:targetClass="com.knowarth.appshortcutdemo.MainActivity"></intent>

<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.knowarth.appshortcutdemo.AddEvents"
android:targetPackage="com.knowarth.appshortcutdemo" ></intent>
</shortcut> 

Once you have followed above steps, your phone’s screen will look like an image shown below.

Android Application

Dynamic Shortcuts

To create dynamic shortcut, you need to use ShortcutManager APK. You will need to define each shortcut using ‘Shortcutinfo’ that provides UI information of the shortcut to your phone.

You can also use multiple intent tags to navigate within the application. Follow these steps to create a Dynamic App Shortcut using MainActivity.onCreate() method.

Change your shortcut preference

 ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);

ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "shortcut_view_events")
.setShortLabel("View Events")
.setLongLabel("View Events")
.setRank(1)
.setIcon(Icon.createWithResource(this, R.drawable.view_event))
.setIntents(new Intent[]{
new Intent(Intent.ACTION_VIEW, Uri.EMPTY, this, MainActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK),
new Intent(Intent.ACTION_VIEW, Uri.EMPTY, this, ViewEvents.class)
})
.build();

shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut )); 
Android Nougat

Given are brief examples on how to create an application shortcut with your android phone on Android Nougat.

Related Blogs

Myths for Enterprise Mobile App Development

Common Myths for Enterprise Mobile App Development

https://www.knowarth.com/wp-content/uploads/2019/11/Myths-for-Enterprise-Mobile-App-Development-1.png 400 1140 Pinakin Darji https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Pinakin Darji2019-11-07 17:09:502019-11-26 17:11:25Common Myths for Enterprise Mobile App Development
Liferay-7.2

What’s New in Liferay DXP 7.2?

https://www.knowarth.com/wp-content/uploads/2019/10/Liferay-7.2-1.png 400 1140 Pinakin Darji https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Pinakin Darji2019-10-23 17:12:392019-11-26 18:05:02What’s New in Liferay DXP 7.2?
On Demand Mobile Application Development

On Demand Mobile Application Development: The Future of Mobility

https://www.knowarth.com/wp-content/uploads/2019/11/On-Demand-Mobile-Application-Development.png 400 1140 Krunal Vyas https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Krunal Vyas2019-08-01 16:47:252019-11-26 16:53:14On Demand Mobile Application Development: The Future of Mobility
Mobile-Banking-Application

Top 6 reasons businesses should develop mobile banking application

https://www.knowarth.com/wp-content/uploads/2019/07/Mobile-Banking-Application-Blog-banner.png 400 1140 Pinakin Darji https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Pinakin Darji2019-07-10 17:09:562019-07-12 19:46:04Top 6 reasons businesses should develop mobile banking application
More Blogs

Services

  • Enterprise Portal Development
  • eCommerce Portal Development
  • Cloud Infra & Management Services
More Services

Solutions

  • Enterprise Content Management System
  • Learning Management System
  • Hospital Management System
More Solutions

Categories

Mobile Application Technologies

Related Case Studies

SAAS based productivity management suite

SAAS based productivity management suite

https://www.knowarth.com/wp-content/uploads/2017/02/SAAS-based-productivity-management-suite.jpg 657 1920 Krupal Khatri https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Krupal Khatri2017-02-28 15:19:302017-02-28 16:39:41SAAS based productivity management suite
Hospital Management System with Secure Mobile Application

Hospital Management System with Secure Mobile Application

https://www.knowarth.com/wp-content/uploads/2016/12/Hospital-Management-System-with-Secure-Mobile-Application.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png KNOWARTH Admin2016-12-30 17:41:182017-01-27 22:48:33Hospital Management System with Secure Mobile Application
LIFERAY Clustering with enhanced Security

LIFERAY Clustering with enhanced Security

https://www.knowarth.com/wp-content/uploads/2016/11/LIFERAY-Clustering-with-enhanced-Security.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png KNOWARTH Admin2016-11-22 19:39:172017-01-30 11:35:59LIFERAY Clustering with enhanced Security
Amazon Web Services (AWS) to Open Stack Migration

Amazon Web Services (AWS) to Open Stack Migration

https://www.knowarth.com/wp-content/uploads/2016/11/Amazon-Web-Services-AWS-to-Open-Stack-Migration.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png KNOWARTH Admin2016-11-22 17:51:202017-01-30 11:46:29Amazon Web Services (AWS) to Open Stack Migration

Audit, Document Management and Collaboration Platform

https://www.knowarth.com/wp-content/uploads/2016/11/Case-Study-Audit-Document-Management-and-Collaboration-Platform.jpg 677 1400 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png KNOWARTH Admin2016-11-22 15:16:142017-01-30 14:51:46Audit, Document Management and Collaboration Platform
Corporate Intranet Portal Implementation (USA)

Corporate Intranet Portal Implementation

https://www.knowarth.com/wp-content/uploads/2016/04/Corporate-Intranet-Portal-Implementation-USA1.jpg 657 1920 Chintan Mehta https://www.knowarth.com/wp-content/uploads/2017/01/knowarth-logo.png Chintan Mehta2016-04-26 11:17:242017-01-30 14:54:28Corporate Intranet Portal Implementation
PreviousNext

Follow Us

HRMS-ad-new
MySQL8 For Big Data
Mastering Apache Solr 7.x

Latest Tweets

Tweets by @KNOWARTH
Chintan Mehta
By Chintan Mehta
April 6, 2017

Be the first to get latest blogs
Join our mailing list to get the latest updates! We will not spam you.

Services

  • Enterprise Portal Development
  • Liferay Consulting Services
  • Mobile App Development
  • Software Testing Services
  • ERP Implementation
  • RIM Services
  • View All Services

Solutions

  • Liferay Portal Development
  • Liferay Migration and Upgrade
  • Digital Experience Platforms
  • Enterprise Mobility Solutions
  • IT Monitoring Solutions
  • Learning Management System
  • View All Solutions

Products

  • Commercium
  • HRMS

Resources

  • Case Studies
  • Blogs
  • Events
  • White Paper
  • Books

Company

  • Who We Are
  • Career
  • Our Partners
  • Our Clients
  • Cookie Policy

Tell us your idea

We like fast - the same way the technology market moves. In the time it takes you to say
"I'hv got a great idea", someone else has already started working on a similar project half the world away.
Contact Us

INDIA: +91 79 6617 3700
USA: +1 803 767 4034
AUSTRALIA: +61282792090
contact@knowarth.com
© 2018 KNOWARTH, All Rights Reserved
Cracking the Challenges of Mobile App Development for Customer Facing Appli... How to Flash and Install Recovery on Android devices
Scroll to top

Schedule A Consultation

Field marked * are mandatory.