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:
- When the screen is off, the activity you've set via the full screen intent is launched instead of the notification being posted.
- 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).