Head up notification NOT works when unlocked screen

22 hours ago 3
ARTICLE AD BOX
FSI means 'Full Screen Indent' HUN means 'Head Up Notification'

Samsung Galaxy S20 Plus (Physical Device)

Android 15

One UI 7.0

screen lock with password

Korea (South)

Android Studio 2025. 2. 3.

I allowed notification and FSI. For notification setup, see under image

I make all activity with Jetpack compose

I allowed all types notification

I fired notify in alarm broadcast receiver.

FSI when screen locked works well. Activity shown. HUN when screen unlocked NOT WORKS. General notification shown. class AlarmReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Log.i("receiver", "I received alarm broadcast") val intent = Intent(context, AppointmentActivity::class.java).apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NO_USER_ACTION } val pIndent = PendingIntent.getActivity( context, 4, intent, PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT ) val notification = NotificationCompat.Builder(context, context.getString(R.string.appointment_notify_channel_id)) .setContentTitle("Title") .setContentText("..and content") .setSmallIcon(R.drawable.ansomi) .setPriority(NotificationCompat.PRIORITY_MAX) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setCategory(NotificationCompat.CATEGORY_RECOMMENDATION) .setFullScreenIntent(pIndent, true) .build() (context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).notify( context.resources.getInteger(R.integer.APPOINTMENT_NOTIFY_ID), notification ) Log.i("receiver", "WTF why not works?") // this log alayws print } } // this code is part of Main Activity override fun onResume() { super.onResume() if(!(getSystemService(ALARM_SERVICE) as AlarmManager).canScheduleExactAlarms()){ startActivity( Intent().apply { action = Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM } ) return }else{ Log.i("Main Activity", "Exact Alarm is allowed") } if(!(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).canUseFullScreenIntent()){ startActivity( Intent().apply { action = Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT } ) return }else{ Log.i("Main Activity", "FSI allowed") } startActivity(Intent(this, TimerActivity::class.java)) // when all permission good, going to next activity finish() // Main Activity just check permissions. } override fun onStart() { super.onStart() (getSystemService(NOTIFICATION_SERVICE) as NotificationManager).run { listOf(R.string.foreground_notify_channel_id, R.string.timer_notify_channel_id, R.string.appointment_notify_channel_id).forEach{ id -> deleteNotificationChannel(getString(id)) } createNotificationChannels( listOf( NotificationChannel( getString(R.string.foreground_notify_channel_id), getString(R.string.foreground_notify_channel_name), NotificationManager.IMPORTANCE_DEFAULT ), NotificationChannel( getString(R.string.timer_notify_channel_id), getString(R.string.timer_notify_channel_name), NotificationManager.IMPORTANCE_LOW ).apply { enableVibration(false) vibrationPattern = null }, NotificationChannel( getString(R.string.appointment_notify_channel_id), getString(R.string.appointment_notify_channel_name), NotificationManager.IMPORTANCE_HIGH ).apply { enableVibration(true) lockscreenVisibility = Notification.VISIBILITY_PUBLIC } ) ) } } <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
Read Entire Article