diff --git a/.changeset/eighty-ghosts-count.md b/.changeset/eighty-ghosts-count.md
new file mode 100644
index 000000000..324c8638b
--- /dev/null
+++ b/.changeset/eighty-ghosts-count.md
@@ -0,0 +1,5 @@
+---
+'@capawesome/capacitor-app-shortcuts': minor
+---
+
+feat(android): string type support for `androidIcon`
diff --git a/packages/app-shortcuts/README.md b/packages/app-shortcuts/README.md
index 0cef32278..f3bf90004 100644
--- a/packages/app-shortcuts/README.md
+++ b/packages/app-shortcuts/README.md
@@ -242,7 +242,7 @@ Remove all listeners for this plugin.
| **`id`** | string | The unique identifier. | 6.0.0 |
| **`title`** | string | The display name. | 6.0.0 |
| **`icon`** | string \| number | The icon to display. On **Android**, the icon is the constant integer value of the [R.drawable](https://developer.android.com/reference/android/R.drawable) enum (e.g. `17301547`). On **iOS**, the icon can be one of the following: - The constant integer value of the [UIApplicationShortcutIcon.IconType](https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon/icontype) enum (e.g. `6`). - A system symbol name (e.g. `star.fill`). - Name of the image asset from the asset catalogue. | 6.1.0 |
-| **`androidIcon`** | number | The icon to display on Android. The icon is the constant integer value of the [R.drawable](https://developer.android.com/reference/android/R.drawable) enum (e.g. `17301547`). | 7.2.0 |
+| **`androidIcon`** | string \| number | The icon to display on Android. The icon is the constant name or the integer value of the [R.drawable](https://developer.android.com/reference/android/R.drawable) enum (e.g. `17301547`, `"alert_dark_frame"`). | 7.2.0 |
| **`iosIcon`** | string \| number | The icon to display on iOS. The icon can be one of the following: - The constant integer value of the [UIApplicationShortcutIcon.IconType](https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon/icontype) enum (e.g. `6`). - A system symbol name (e.g. `star.fill`). - Name of the image asset from the asset catalogue. | 7.2.0 |
diff --git a/packages/app-shortcuts/android/src/main/java/io/capawesome/capacitorjs/plugins/appshortcuts/AppShortcutsHelper.java b/packages/app-shortcuts/android/src/main/java/io/capawesome/capacitorjs/plugins/appshortcuts/AppShortcutsHelper.java
index 4fc3db239..45b3e9eca 100644
--- a/packages/app-shortcuts/android/src/main/java/io/capawesome/capacitorjs/plugins/appshortcuts/AppShortcutsHelper.java
+++ b/packages/app-shortcuts/android/src/main/java/io/capawesome/capacitorjs/plugins/appshortcuts/AppShortcutsHelper.java
@@ -57,8 +57,14 @@ public static List createShortcutInfoCompatList(JSArray shor
(String) id
)
);
+
if (androidIcon != null) {
- shortcutInfoCompat.setIcon(IconCompat.createWithResource(context, (int) androidIcon));
+ try {
+ int iconResId = context.getResources().getIdentifier((String) androidIcon, "drawable", "android");
+ shortcutInfoCompat.setIcon(IconCompat.createWithResource(context, iconResId));
+ } catch (Exception exception) {
+ shortcutInfoCompat.setIcon(IconCompat.createWithResource(context, (int) androidIcon));
+ }
} else if (icon != null) {
shortcutInfoCompat.setIcon(IconCompat.createWithResource(context, (int) icon));
}
diff --git a/packages/app-shortcuts/example/package-lock.json b/packages/app-shortcuts/example/package-lock.json
index 2a12023df..302c0563c 100644
--- a/packages/app-shortcuts/example/package-lock.json
+++ b/packages/app-shortcuts/example/package-lock.json
@@ -20,7 +20,7 @@
},
"..": {
"name": "@capawesome/capacitor-app-shortcuts",
- "version": "7.1.0",
+ "version": "7.2.0",
"funding": [
{
"type": "github",
diff --git a/packages/app-shortcuts/example/src/js/script.js b/packages/app-shortcuts/example/src/js/script.js
index 011468c62..121bfdf6b 100644
--- a/packages/app-shortcuts/example/src/js/script.js
+++ b/packages/app-shortcuts/example/src/js/script.js
@@ -1,5 +1,4 @@
import { AppShortcuts } from '@capawesome/capacitor-app-shortcuts';
-import { Capacitor } from '@capacitor/core';
document.addEventListener('DOMContentLoaded', () => {
const initialize = async () => {
@@ -24,7 +23,8 @@ document.addEventListener('DOMContentLoaded', () => {
description: 'Let us know how we can improve',
id: 'feedback',
title: 'Feedback',
- icon: Capacitor.getPlatform() === 'ios' ? 6 : 17301547,
+ iosIcon: 6,
+ androidIcon: 17301547, // 'alert_dark_frame'
},
],
});
diff --git a/packages/app-shortcuts/src/definitions.ts b/packages/app-shortcuts/src/definitions.ts
index 112897e05..60f213ebc 100644
--- a/packages/app-shortcuts/src/definitions.ts
+++ b/packages/app-shortcuts/src/definitions.ts
@@ -132,12 +132,13 @@ export interface Shortcut {
/**
* The icon to display on Android.
*
- * The icon is the constant integer value of the [R.drawable](https://developer.android.com/reference/android/R.drawable) enum (e.g. `17301547`).
+ * The icon is the constant name or the integer value of the [R.drawable](https://developer.android.com/reference/android/R.drawable) enum (e.g. `17301547`, `"alert_dark_frame"`).
*
* @since 7.2.0
* @example 17301547
+ * @example "alert_dark_frame"
*/
- androidIcon?: number;
+ androidIcon?: number | string;
/**
* The icon to display on iOS.
*