How to get notified about back events while still supporting predictive back?
07:05 05 Nov 2025

I need to track the info that a user cancelled out of a certain screen. So I'd like a way to be notified when the user goes back with a gesture or the back button.

Yes, I can add a callback to the OnBackPressedDispatcher or the OnBackInvokedDispatcher but doing so removes the predictive back animation.

The Activity's onBackPressed is no longer called on newer APIs so that is out of the question as well.

What am I missing?

android