From 0a713b6ccb418d8947ffed20f4108a18e9b0fa42 Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Thu, 13 Nov 2025 10:41:19 +0100 Subject: [PATCH 1/2] notification.extras also contains non-string values The method `getDeliveredNotifications()` throws because `getString(key)` is called on `notification.extras` but the `extras` [`Bundle`](https://developer.android.com/reference/android/os/Bundle) object contains more than just strings. --- .../plugins/pushnotifications/PushNotificationsPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java index 8b68231796..1ce5332c1e 100644 --- a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java +++ b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java @@ -144,7 +144,7 @@ public void getDeliveredNotifications(PluginCall call) { JSObject extras = new JSObject(); for (String key : notification.extras.keySet()) { - extras.put(key, notification.extras.getString(key)); + extras.put(key, notification.extras.get(key)); } jsNotif.put("data", extras); From 9e6302ea38fa29b1e73c319f9a19acfccbdc554e Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Thu, 13 Nov 2025 11:34:17 +0100 Subject: [PATCH 2/2] bundle can contain more than just strings, fix for handle intent --- .../plugins/pushnotifications/PushNotificationsPlugin.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java index 1ce5332c1e..377262dc78 100644 --- a/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java +++ b/push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java @@ -64,8 +64,7 @@ protected void handleOnNewIntent(Intent data) { if (key.equals("google.message_id")) { notificationJson.put("id", bundle.getString(key)); } else { - String valueStr = bundle.getString(key); - dataObject.put(key, valueStr); + dataObject.put(key, bundle.get(key)); } } notificationJson.put("data", dataObject);