From 4bf0a56175b097f216bb1df7a0e7f393759fccf7 Mon Sep 17 00:00:00 2001 From: Gautier de Lataillade <32983806+gdelataillade@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:28:39 +0100 Subject: [PATCH] Add android notification large icon --- .../com/gdelataillade/alarm/services/NotificationService.kt | 3 +++ lib/model/alarm_settings.dart | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/kotlin/com/gdelataillade/alarm/services/NotificationService.kt b/android/src/main/kotlin/com/gdelataillade/alarm/services/NotificationService.kt index 6e2a06a3..f99ec2a5 100644 --- a/android/src/main/kotlin/com/gdelataillade/alarm/services/NotificationService.kt +++ b/android/src/main/kotlin/com/gdelataillade/alarm/services/NotificationService.kt @@ -6,6 +6,7 @@ import android.app.NotificationManager import android.app.PendingIntent import android.content.Context import android.content.Intent +import android.graphics.BitmapFactory import android.os.Build import android.net.Uri import android.media.AudioAttributes @@ -38,6 +39,7 @@ class NotificationHandler(private val context: Context) { fun buildNotification(title: String, body: String, fullScreen: Boolean, pendingIntent: PendingIntent): Notification { val iconResId = context.resources.getIdentifier("ic_launcher", "mipmap", context.packageName) + val largeIcon = BitmapFactory.decodeResource(context.resources, iconResId) val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) val notificationPendingIntent = PendingIntent.getActivity( context, @@ -54,6 +56,7 @@ class NotificationHandler(private val context: Context) { notificationBuilder .setSmallIcon(iconResId) + .setLargeIcon(largeIcon) .setContentTitle(title) .setContentText(body) .setPriority(NotificationCompat.PRIORITY_MAX) diff --git a/lib/model/alarm_settings.dart b/lib/model/alarm_settings.dart index fa6202a0..85c85a37 100644 --- a/lib/model/alarm_settings.dart +++ b/lib/model/alarm_settings.dart @@ -48,7 +48,8 @@ class AlarmSettings { /// the user that the alarms won't ring anymore. Enabled by default. final bool enableNotificationOnKill; - /// Whether to turn screen on when android alarm notification is triggered. Enabled by default. + /// Whether to turn screen on and display full screen notification + /// when android alarm notification is triggered. Enabled by default. final bool androidFullScreenIntent; /// Returns a hash code for this `AlarmSettings` instance using Jenkins hash function.