I'm trying to create from my player app an home screen shortcut that will trigger the playback of a specific live stream, without opening an activity. Unfortunately this doesn't work...
ShortcutManager sM = c.getSystemService(ShortcutManager.class);
Intent intent2 = new Intent(c.getApplicationContext(), APPBroadcastReceiver.class);
intent2.setAction("toggle_intent");
intent2.putExtra("id", 1);
ShortcutInfo shortcut2 = new ShortcutInfo.Builder(c,MSG_SHORCUT_CUSTOM)
.setIntent(intent2)
.setShortLabel("ShortLabel")
.setLongLabel("LongLaber")
.setDisabledMessage("DisabledMessage")
.setIcon(Icon.createWithResource(c, R.mipmap.ic_add_outline_short))
.build();
listshortcut.add(shortcut2);
Intent pinnedShortcutCallbackIntent = mShortcutManager.createShortcutResultIntent(shortcut2);
PendingIntent successCallback = PendingIntent.getBroadcast(context, 0, pinnedShortcutCallbackIntent, 0);
mShortcutManager.requestPinShortcut(pinShortcutInfo, successCallback.getIntentSender());
The shortcurt is created but all I get when I press on it is 'Application not installed' As soon as I replace my Receiver class by an activity the activity opens.
Is it possible to trigger a custom intent that won't open an activity from an home screen shortcut?