3

Add "Priority conversations" to "Allow SMS Senders" in Do Not Disturb Action (Mode: custom settings)

In the tasker Do Not Disturb action (Mode: custom settings), as "Allow SMS Senders", I see 4 options:
- Any
- Contacts
- Starred
- None

But ... in the corresponding systems settings (Android 14) there is also another (new ?) option:
- Priority conversations

Is possible to activate it from tasker ?

2 replies

MD

👍 would very much like to see this added to Tasker

I'm using Tasker to switch between different levels of DND at different times through the "custom settings" mode, but this approach is currently incompatible with Android's "priority conversations". Even if I manually set it to allow priority conversations in the Android settings, the next time Tasker updates my DND settings, it will be unset again. AFAIK there's currently no way to make Tasker ignore the "allow SMS senders" setting when it sets the custom mode either

I

FYI: Following code seems do that...
I'm testing it in a custom takser plugin.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
    val notificationManager = context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager

    val notificationPolicy = notificationManager.notificationPolicy

    val newPolicy = NotificationManager.Policy(
        notificationPolicy.priorityCategories or PRIORITY_CATEGORY_CONVERSATIONS,
        notificationPolicy.priorityCallSenders,
        notificationPolicy.priorityMessageSenders,
        notificationPolicy.suppressedVisualEffects,
        CONVERSATION_SENDERS_IMPORTANT
    )

    notificationManager.setInterruptionFilter(INTERRUPTION_FILTER_PRIORITY)
    notificationManager.notificationPolicy = newPolicy
}

*Requires "Notification policy access" is granted