Skip to content

Commit

Permalink
Add android notification large icon
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelataillade committed Jan 22, 2024
1 parent b251a3b commit 4bf0a56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -54,6 +56,7 @@ class NotificationHandler(private val context: Context) {

notificationBuilder
.setSmallIcon(iconResId)
.setLargeIcon(largeIcon)
.setContentTitle(title)
.setContentText(body)
.setPriority(NotificationCompat.PRIORITY_MAX)
Expand Down
3 changes: 2 additions & 1 deletion lib/model/alarm_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4bf0a56

Please sign in to comment.