Skip to content

Commit 81ddece

Browse files
fix(android): notification Bundles with non-string values (#2445)
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
1 parent c623a3e commit 81ddece

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void getDeliveredNotifications(PluginCall call) {
141141
JSObject extras = new JSObject();
142142

143143
for (String key : notification.extras.keySet()) {
144-
extras.put(key, notification.extras.getString(key));
144+
extras.put(key, notification.extras.get(key));
145145
}
146146

147147
jsNotif.put("data", extras);

push-notifications/android/src/main/java/com/capacitorjs/plugins/pushnotifications/PushNotificationsPlugin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ protected void handleOnNewIntent(Intent data) {
6464
if (key.equals("google.message_id")) {
6565
notificationJson.put("id", bundle.getString(key));
6666
} else {
67-
String valueStr = bundle.getString(key);
68-
dataObject.put(key, valueStr);
67+
dataObject.put(key, bundle.get(key));
6968
}
7069
}
7170
notificationJson.put("data", dataObject);
@@ -144,7 +143,7 @@ public void getDeliveredNotifications(PluginCall call) {
144143
JSObject extras = new JSObject();
145144

146145
for (String key : notification.extras.keySet()) {
147-
extras.put(key, notification.extras.getString(key));
146+
extras.put(key, notification.extras.get(key));
148147
}
149148

150149
jsNotif.put("data", extras);

0 commit comments

Comments
 (0)