Android 8.0 (Oreo) 前後ショートカット作成方法の違い - Android Studio
Android 8 (O) API26 からショートカットの作成方法が変わったのでメモ String shortcutName = "Shortcut Name"; Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); shortcutIntent.setClassName(this, "com.example.myApplication"); // 呼び出すActivity shortcutIntent.putExtra("key1", "value1"); // 渡す情報() shortcutIntent.putExtra("key2", "value2"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // Android 8 O API26 以降 Icon icon = Icon.createWithResource(getApplicationContext(), R.mipmap.ic_shortcut); ShortcutInfo shortcut = new ShortcutInfo.Builder(getApplicationContext(), shortcutName) .setShortLabel(shortcutName) .setLongLabel(shortcutName) .setIcon(icon) .setIntent(shortcutIntent) .build(); ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); shortcutManager.requestPinShortcut(shortcut, null); // フツーのショート...