0

I am developing a react-native app with a video call feature and need it to display a 'heads up' notification that lasts for 40 seconds when the user receives a call, but the notification only displays for about three seconds before disappearing. I have tried setting the category to 'call' and priority to 'max' on Android 6.0 but to no avail.

An image displaying a notification for an incoming call:

An image displaying a notification for incoming call

Fred Sobotka
  • 5,252
  • 22
  • 32

1 Answers1

2

You should use the equivalent to the setFullScreenIntent() API on your notification:

An intent to launch instead of posting the notification to the status bar. Only for use with extremely high-priority notifications demanding the user's immediate attention, such as an incoming phone call or alarm clock that the user has explicitly set to a particular time.

The system UI may choose to display a heads-up notification, instead of launching this intent, while the user is using the device.

When you set a full screen Intent on your Notification, two things happen:

  1. When the screen is off, the activity you've set via the full screen intent is launched instead of the notification being posted.
  2. When the screen is on, your notification will be posted as a heads up notification that will be persistent (it won't collapse to the status bar unlike a normal heads up notification).
Community
  • 1
  • 1
ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Thank you so much. Very helpful. But please is there a way I can use the setFullScreenIntent() API from react-native even if I would have to write native code. Once again, thank you so much. I'm very grateful for your response. – Asimadu Kingsford May 25 '19 at 07:49