Example usage for android.content.pm ShortcutInfo getPackage

List of usage examples for android.content.pm ShortcutInfo getPackage

Introduction

In this page you can find the example usage for android.content.pm ShortcutInfo getPackage.

Prototype

@NonNull
public String getPackage() 

Source Link

Document

Return the package name of the publisher app.

Usage

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

private boolean isCreatedShortcut() {
    if (DEBUG) {/*from w w  w . j  a  v  a 2  s  . c o  m*/
        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;
    }
}