Usually not, but 2 weeks later with no response for such a simple question, I think this is totally ok.
This might help:
https://ionicframework.com/docs/api/platform/Platform/#registerBackButtonAction
https://cordova.apache.org/docs/en/latest/cordova/events/events.html#backbutton