Hello, I would like to know if it is possible to create keys in the shortcut menu in AI2. To be clear, the shortcut menu is this:
So I was just wondering if it was possible to do this!
Thanks in advance,
Nico
Hello, I would like to know if it is possible to create keys in the shortcut menu in AI2. To be clear, the shortcut menu is this:
So I was just wondering if it was possible to do this!
Thanks in advance,
Nico
I asked Gemini and this was the answer, see below
Tldr: it is not possible
That's an interesting question! While Android allows users to create shortcuts on their home screen, programmatically creating icons directly in the shortcuts pane (which I understand to be the quick settings panel you access by swiping down from the top) is not a standard or officially supported Android development feature for regular apps.
Here's a breakdown of why and what alternatives exist:
Why it's not directly supported:
Intent addIntent = new Intent();
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "My App Action"); // Shortcut title
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_launcher)); // Shortcut icon
context.sendBroadcast(addIntent);
Intent actionIntent = new Intent(context, YourActionReceiver.class); // Replace YourActionReceiver
PendingIntent actionPendingIntent =
PendingIntent.getBroadcast(context, 0, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
builder.addAction(R.drawable.ic_quick_action, "Quick Action", actionPendingIntent);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(notificationId, builder.build());
In summary, directly adding custom icons to the Android quick settings panel programmatically from a regular app is not a supported feature due to system-level restrictions and security considerations. You should explore alternative approaches like home screen shortcuts, app widgets, or notifications with quick actions to provide quick access to your app's functionality.
Could you tell me more about what specific functionality you were hoping to make quickly accessible? Knowing your use case might help me suggest the most suitable alternative.
Taifun
Thank you for this very comprehensive answer! I am disappointed that I cannot do what I wanted, but thank you anyway!
Nico