feat: support bitmap and adaptive icons for Android shortcuts
Plugin(s)
- [x] App Shortcuts
Current problem
Right now, there's no way to set an arbitrary image as the shortcut icon for Android, just the very old predefined drawables.
Preferred solution
Either allowing a bitmap or a resource when registering an icon.
AppShortcuts.set({
shortcuts: [{
id: "create",
title: "Create Content",
icon:
Capacitor.getPlatform() === "ios"
? "plus.circle"
: { type: "bitmap", name: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QC..." }, // bitmap
}, {
id: "friends",
title: "Your Friends",
icon:
Capacitor.getPlatform() === "ios"
? "person.3"
: { type: "resource", name: "@drawable/friends" }, // resource
}],
});
Alternative options
Using https://github.com/NePheus/capacitor-android-shortcuts#availableicontypes
Additional context
https://developer.android.com/develop/ui/views/launch/shortcuts/creating-shortcuts
Before submitting
- [x] I have read and followed the feature request guidelines.
- [x] I have attached links to possibly related issues and discussions.
Yes, this feature is missing. The androidIcon property should accept a base64 string. Would you be willing to work on it? It should quiet easy to implement.
Unfortunately I know next to nothing about Java/actual Android development -- if you think it wouldn't require too many Java changes I could maybe give it a shot, but I can't guarantee I'd be able to get to it in a timely fashion 😅