Example usage for android.content.pm ShortcutManager getPinnedShortcuts

List of usage examples for android.content.pm ShortcutManager getPinnedShortcuts

Introduction

In this page you can find the example usage for android.content.pm ShortcutManager getPinnedShortcuts.

Prototype

@NonNull
public List<ShortcutInfo> getPinnedShortcuts() 

Source Link

Document

Return all pinned shortcuts from the caller app.

Usage

From source file:org.deviceconnect.android.deviceplugin.demo.DemoSettingFragment.java

private boolean isCreatedShortcut() {
    if (DEBUG) {//from w  w  w. j  av  a  2s. c  om
        Log.d(TAG, "DemoPageSetting: isCreatedShortcut");
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        ShortcutManager shortcutManager = mShortcutManager;
        List<ShortcutInfo> infoList = shortcutManager.getPinnedShortcuts();
        if (DEBUG) {
            Log.d(TAG, "DemoPageSetting: isCreatedShortcut: PinnedShortcuts=" + infoList.size());
            Log.d(TAG, "DemoPageSetting: isCreatedShortcut: DynamicShortcuts="
                    + shortcutManager.getDynamicShortcuts());
        }
        for (ShortcutInfo info : infoList) {
            if (DEBUG) {
                Log.d(TAG, "DemoPageSetting: isCreatedShortcut: info=" + info.getPackage());
            }
            if (info.getId().equals(CAMERA_DEMO_SHORTCUT_ID)) {
                return true;
            }
        }
        return false;
    } else {
        return false;
    }
}