Prevent from closing the app

Hi there,
I have an app on ionic 4 and on the first page after initialization I have a modal. Problem is, when I open this modal and then click on HW back button on android, the app closes.

Is there a way, how to prevent app closes in this case?

Thanks

This solution is for closing app. I need to prevent from closing.

If I use this.platform.backButton.subscribe... Then I use some action in it, the app closes anyway…

If you don’t write any code in this.platform.backbutton.subscribe it will not close app i guess.

What I’m saying is don’t write navigator['app'].exitApp();

Unfortunatelly it do not help :-/. If I do not write this part of code and use another, it will always close the app then :-/