0

I have added two action in this head-up notification Answer and Reject . which is worked in all device under android-12.

But in android 12 this type of notification not showing . what the exact problem i don't know I read documentation but not found any solution. call_screenshot

I checked all notification setting of app inside my device. Is in android 12 any changes regarding this type of notification . please your answer will help us thanks.

1 Answers1

1

I have achieved this in my project using below code First of all, add permission in AnroidManifest.xml:

<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

Now set full screen intent in your notification builder with your activity as below:

var answerCallIntent = Intent(this@FirebaseInstanceService, AnswerDeclineCallActivity::class.java)
var answerCallPendingIntent = PendingIntent.getActivity(this@FirebaseInstanceService,
   0, answerCallIntent, PendingIntent.FLAG_UPDATE_CURRENT)
   setFullScreenIntent(answerCallPendingIntent, true)

Note : Some devices like Xiaomi, you have to redirect user to settings to enable "show on lock screen" permission to show activity in lockscreen.

Make sure you have set priority to max in notification builder:

.setPriority(Notification.PRIORITY_MAX) //Important for heads-up notification
Jaydeep parmar
  • 561
  • 2
  • 15