diff --git a/app/src/main/java/me/siddheshkothadi/codexdroid/notifications/CodexDroidNotifications.kt b/app/src/main/java/me/siddheshkothadi/codexdroid/notifications/CodexDroidNotifications.kt index d44b773..663c266 100644 --- a/app/src/main/java/me/siddheshkothadi/codexdroid/notifications/CodexDroidNotifications.kt +++ b/app/src/main/java/me/siddheshkothadi/codexdroid/notifications/CodexDroidNotifications.kt @@ -10,10 +10,12 @@ import android.os.Build import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.toBitmap import me.siddheshkothadi.codexdroid.R object CodexDroidNotifications { - const val TURN_CHANNEL_ID = "turn_events" + // Use a versioned channel ID because Android preserves existing channel settings by ID. + const val TURN_CHANNEL_ID = "turn_events_v2" fun canPostNotifications(context: Context): Boolean { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return true @@ -33,10 +35,12 @@ object CodexDroidNotifications { NotificationChannel( TURN_CHANNEL_ID, "Turn updates", - NotificationManager.IMPORTANCE_DEFAULT + NotificationManager.IMPORTANCE_HIGH ).apply { description = "Notifications when Codex finishes a turn." setShowBadge(true) + enableVibration(true) + enableLights(true) } manager.createNotificationChannel(channel) } @@ -59,16 +63,25 @@ object CodexDroidNotifications { } ensureTurnChannel(context) + val appIcon = + runCatching { + context.packageManager + .getApplicationIcon(context.applicationInfo) + .toBitmap() + }.getOrNull() + val notification = NotificationCompat.Builder(context, TURN_CHANNEL_ID) - .setSmallIcon(R.mipmap.ic_launcher) + .setSmallIcon(R.drawable.ic_launcher_foreground) + .setLargeIcon(appIcon) .setContentTitle(title) .setContentText(text) .setStyle(NotificationCompat.BigTextStyle().bigText(text)) .setAutoCancel(true) .setContentIntent(contentIntent) .setCategory(NotificationCompat.CATEGORY_MESSAGE) - .setPriority(NotificationCompat.PRIORITY_DEFAULT) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .setDefaults(NotificationCompat.DEFAULT_ALL) .build() try { @@ -78,4 +91,3 @@ object CodexDroidNotifications { } } } -