notifee
notifee copied to clipboard
[Android] Quick Action always requires device to be unlocked on Android 12
On Android 12+, quick actions are created with NotificationPendingIntent.createIntent
which uses PendingIntent.getActivities
https://github.com/invertase/notifee/blob/f78a56518b1fe0dab060e96c2a1f145e41b7363a/android/src/main/java/app/notifee/core/NotificationPendingIntent.java#L89-L94
According to Android documentation, a notification action that launches an activity requires the user to unlock their device.
If a notification action causes an app to launch an activity or send a direct reply, users must unlock the device before the app can invoke that notification action.
In this example from Android's documentation for creating a "Snooze" action, they're using PendingIntent.getBroadcast
, which executes the snoozing without launching the activity, and doesn't require the user to unlock their phone.
Intent snoozeIntent = new Intent(this, MyBroadcastReceiver.class);
snoozeIntent.setAction(ACTION_SNOOZE);
snoozeIntent.putExtra(EXTRA_NOTIFICATION_ID, 0);
PendingIntent snoozePendingIntent =
PendingIntent.getBroadcast(this, 0, snoozeIntent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!")
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.addAction(R.drawable.ic_snooze, getString(R.string.snooze),
snoozePendingIntent);
A potential solution here may be to use BroadcastReceiver for quick actions that are not launching an activity? (i.e. have launchActivity and getMainComponent set to null) For my use case, I would like the user to be able to Snooze a notification, or "Mark as complete" without needing to unlock their phone.
P.S. Not sure if this is related but I've also noticed pressing any quick action automatically closes the notification drawer, even if I have autoCancel set to false, and launchActivity is null. This makes it harder for users to go through a list of notifications and press the "archive" action on each one since it keeps closing the drawer after each action.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
This has not been fixed yet
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
I assume this is still relevant since there's not been a new release of Notifee since it was raised (haven't got time to check the behaviour directly right now, sorry! 🙏 )
most likely still relevant then yes - still working my way to the surface to give this repo the polish it deserves but getting closer
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
still persists
Need this for silent action triggers without opening the app itself.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Not stale
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
still persists
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Not stale