Hardware back button not working for some android version

I have written code for handling of back button, It works fine for lolipop version. But for marshmallow and nogat it works one time when app is installed, after app reopen is it not working
Following are code

this.platform.registerBackButtonAction(() => {

Please help me