Deactivate hardware back button on specific view

Hello All,

I am trying to deal with an issue on phonegap-plugin barecode scanner.
This plugiin when clicking on the hardware back button is closed but back event is propagated and make the ionic app closed because I am on the main page.
The issue is due to the plugin itself as for cordova camera this issue do not exists.

I saw that I can register with Platform I can register to the backbutton event

However What I would like is:
1/ When entering in the view save the previous event
2/ Replace the event by an empty event to prevent closing
3/ When leaving the view resubscribe with original one

I don’t know how to get this previous event in ionic 3

Do you have an idea

In the constructor function of main page
add following code to override the back button functionality. Maintain a flag that will indicate if the barcode scanner plugin is opened or not if it is not opened then exit from else continue with the app.

this.platform.ready().then(() => {
document.addEventListener(‘backbutton’, () => {
if (barcodeScannerIsOpen)