Language

IOnBackInvokedDispatcher.PrioritySystemNavigationObserver Field

Definition

Priority level of OnBackInvokedCallbacks designed to observe system-level back handling.

[Android.Runtime.Register("PRIORITY_SYSTEM_NAVIGATION_OBSERVER", ApiSince=36)]
public const int PrioritySystemNavigationObserver = -2;
[<Android.Runtime.Register("PRIORITY_SYSTEM_NAVIGATION_OBSERVER", ApiSince=36)>]
val mutable PrioritySystemNavigationObserver : int

Field Value

Value = -2
Attributes

Remarks

Priority level of OnBackInvokedCallbacks designed to observe system-level back handling.

Callbacks registered with this priority are invoked only when a back event is not consumed by any other registered OnBackInvokedCallback with a priority of #PRIORITY_DEFAULT or higher. This means they are called when the system is about to perform its default back navigation action, such as finishing the current activity or executing a back-to-home animation.

These callbacks are purely observational. They do not consume the back event and cannot intercept it. Their invocation has no impact on the normal back navigation flow, making them suitable for logging, analytics, or triggering actions that should not prevent the system's own back handling.

The invocation order for multiple callbacks registered with this priority is undefined.

On API level 36 only, there is a restriction that only one callback with #PRIORITY_SYSTEM_NAVIGATION_OBSERVER can be registered at a time. On API level 37 and higher, the number of registered observer callbacks is unrestricted.

Java documentation for android.window.OnBackInvokedDispatcher.PRIORITY_SYSTEM_NAVIGATION_OBSERVER.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to