Skip to content

Android HandleOnBackPressed not triggered on .NET MAUI 10.0.40 onwards #34379

@ManuLin

Description

@ManuLin

Description

We have a .NET MAUI / Blazor hybrid application and use a custom OnBackPressedCallback to handle back navigation via the hardware button, as suggested by Google. This solution used to work up to .NET MAUI version 10.0.31. From version 10.0.40 onwards, the "HandleOnBackPressed" method of the callback is not invoked anymore except on the very root page. I am not sure if this might be related to #33825

We are registering the callback in the "OnCreate" method of the Android MainActivity, as described here https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher.

Any help in this regard is greatly appreciated. For the moment, we will stay with version 10.0.31 to keep the navigation working.

Best regards,

Manuel

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

10.0.40

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.30

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions