CHD.HWBackButtonManager 1.0.1

This is a manager to handle hardware backbutton event.

Install-Package CHD.HWBackButtonManager -Version 1.0.1
dotnet add package CHD.HWBackButtonManager --version 1.0.1
<PackageReference Include="CHD.HWBackButtonManager" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CHD.HWBackButtonManager --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Usage:

On your pcl project page:

protected override void OnAppearing()
    {
        base.OnAppearing();

        bool OnBackButtonPressed()
        {
            return false;
        }

        HWBackButtonManager.OnBackButtonPressedDelegate onBackButtonPressedDelegate = new HWBackButtonManager.OnBackButtonPressedDelegate(OnBackButtonPressed);

        HWBackButtonManager.Instance.SetHWBackButtonListener(onBackButtonPressedDelegate);
     

    }



    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        HWBackButtonManager.Instance.RemoveHWBackButtonListener();
    }

On your andriod MainActivity:

    public override void OnBackPressed()
    {


        if (!CHD.HWBackButtonManager.Instance.NotifyHWBackButtonPressed()){
            return;
        }

        base.OnBackPressed();
    }

Usage:

On your pcl project page:

protected override void OnAppearing()
    {
        base.OnAppearing();

        bool OnBackButtonPressed()
        {
            return false;
        }

        HWBackButtonManager.OnBackButtonPressedDelegate onBackButtonPressedDelegate = new HWBackButtonManager.OnBackButtonPressedDelegate(OnBackButtonPressed);

        HWBackButtonManager.Instance.SetHWBackButtonListener(onBackButtonPressedDelegate);
     

    }



    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        HWBackButtonManager.Instance.RemoveHWBackButtonListener();
    }

On your andriod MainActivity:

    public override void OnBackPressed()
    {


        if (!CHD.HWBackButtonManager.Instance.NotifyHWBackButtonPressed()){
            return;
        }

        base.OnBackPressed();
    }

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 453 2/24/2019