diff --git a/plugins/notification/android/src/main/java/Notification.kt b/plugins/notification/android/src/main/java/Notification.kt index 28a58834..bbc75f64 100644 --- a/plugins/notification/android/src/main/java/Notification.kt +++ b/plugins/notification/android/src/main/java/Notification.kt @@ -197,19 +197,19 @@ class Notification { val notification = Notification() notification.source = jsonObject.toString() notification.id = jsonObject.getInteger("id") ?: throw Exception("Missing notification identifier") - notification.body = jsonObject.getString("body") - notification.largeBody = jsonObject.getString("largeBody") - notification.summary = jsonObject.getString("summary") - notification.actionTypeId = jsonObject.getString("actionTypeId") - notification.group = jsonObject.getString("group") - notification.setSound(jsonObject.getString("sound")) - notification.title = jsonObject.getString("title") - notification.setSmallIcon(jsonObject.getString("icon")) - notification.setLargeIcon(jsonObject.getString("largeIcon")) - notification.iconColor = jsonObject.getString("iconColor") + notification.body = jsonObject.getString("body", null) + notification.largeBody = jsonObject.getString("largeBody", null) + notification.summary = jsonObject.getString("summary", null) + notification.actionTypeId = jsonObject.getString("actionTypeId", null) + notification.group = jsonObject.getString("group", null) + notification.setSound(jsonObject.getString("sound", null)) + notification.title = jsonObject.getString("title", null) + notification.setSmallIcon(jsonObject.getString("icon", null)) + notification.setLargeIcon(jsonObject.getString("largeIcon", null)) + notification.iconColor = jsonObject.getString("iconColor", null) notification.attachments = NotificationAttachment.getAttachments(jsonObject) notification.isGroupSummary = jsonObject.getBoolean("groupSummary", false) - notification.channelId = jsonObject.getString("channelId") + notification.channelId = jsonObject.getString("channelId", null) val schedule = jsonObject.getJSObject("schedule") if (schedule != null) { notification.schedule = NotificationSchedule(schedule) @@ -260,7 +260,7 @@ class Notification { val schedule = notification.schedule if (schedule != null) { val jsSchedule = JSObject() - jsSchedule.put("kind", schedule.scheduleObj.getString("kind")) + jsSchedule.put("kind", schedule.scheduleObj.getString("kind", null)) jsSchedule.put("data", schedule.scheduleObj.getJSObject("data")) jsNotification.put("schedule", jsSchedule) } diff --git a/plugins/notification/android/src/main/java/TauriNotificationManager.kt b/plugins/notification/android/src/main/java/TauriNotificationManager.kt index 88a4406d..8c445095 100644 --- a/plugins/notification/android/src/main/java/TauriNotificationManager.kt +++ b/plugins/notification/android/src/main/java/TauriNotificationManager.kt @@ -231,7 +231,7 @@ class TauriNotificationManager( ) { return } - notificationManager.notify(notification.id ?: 0, buildNotification) + notificationManager.notify(notification.id, buildNotification) } }