diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/NotificationChannelManager.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/NotificationChannelManager.java index 011bf0d53..43ca5b75b 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/NotificationChannelManager.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/NotificationChannelManager.java @@ -38,6 +38,7 @@ public NotificationChannelManager(Context context, NotificationManager manager) private static String CHANNEL_IMPORTANCE = "importance"; private static String CHANNEL_VISIBILITY = "visibility"; private static String CHANNEL_SOUND = "sound"; + private static String CHANNEL_VIBRATE = "vibration"; private static String CHANNEL_USE_LIGHTS = "lights"; private static String CHANNEL_LIGHT_COLOR = "lightColor"; @@ -50,6 +51,7 @@ public void createChannel(PluginCall call) { channel.put(CHANNEL_VISIBILITY, call.getInt(CHANNEL_VISIBILITY, NotificationCompat.VISIBILITY_PUBLIC)); channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE)); channel.put(CHANNEL_SOUND, call.getString(CHANNEL_SOUND, null)); + channel.put(CHANNEL_VIBRATE, call.getBoolean(CHANNEL_VIBRATE, false)); channel.put(CHANNEL_USE_LIGHTS, call.getBoolean(CHANNEL_USE_LIGHTS, false)); channel.put(CHANNEL_LIGHT_COLOR, call.getString(CHANNEL_LIGHT_COLOR, null)); createChannel(channel); @@ -63,6 +65,7 @@ public void createChannel(JSObject channel) { NotificationChannel notificationChannel = new NotificationChannel(channel.getString(CHANNEL_ID), channel.getString(CHANNEL_NAME), channel.getInteger(CHANNEL_IMPORTANCE)); notificationChannel.setDescription(channel.getString(CHANNEL_DESCRIPTION)); notificationChannel.setLockscreenVisibility(channel.getInteger(CHANNEL_VISIBILITY)); + notificationChannel.enableVibration(channel.getBool(CHANNEL_VIBRATE)); notificationChannel.enableLights(channel.getBool(CHANNEL_USE_LIGHTS)); String lightColor = channel.getString(CHANNEL_LIGHT_COLOR); if (lightColor != null) { @@ -109,6 +112,7 @@ public void listChannels(PluginCall call) { channel.put(CHANNEL_IMPORTANCE, notificationChannel.getImportance()); channel.put(CHANNEL_VISIBILITY, notificationChannel.getLockscreenVisibility()); channel.put(CHANNEL_SOUND, notificationChannel.getSound()); + channel.put(CHANNEL_VIBRATE, notificationChannel.shouldVibrate()); channel.put(CHANNEL_USE_LIGHTS, notificationChannel.shouldShowLights()); channel.put(CHANNEL_LIGHT_COLOR, String.format("#%06X", (0xFFFFFF & notificationChannel.getLightColor()))); Logger.debug(Logger.tags("NotificationChannel"), "visibility " + notificationChannel.getLockscreenVisibility()); diff --git a/core/src/core-plugin-definitions.ts b/core/src/core-plugin-definitions.ts index ff12893ea..41dd73faa 100644 --- a/core/src/core-plugin-definitions.ts +++ b/core/src/core-plugin-definitions.ts @@ -1587,6 +1587,7 @@ export interface NotificationChannel { visibility?: -1 | 0 | 1 ; lights?: boolean; lightColor?: string; + vibration?: boolean; } export interface NotificationChannelList {