Ionic 4 platform pause resume listener not working

I want to detect device pause and resume events in my page.
I used platform pause and resume methods and java script methods (
document add event listener pause and resume ) But these ways not worked for me.
can anyone help me to do this in ionic 4, please ?
Thank you

1 Like

I am having this issue on the simulator, I will test on the device as well.

Are you using Capacitor? They don’t work yet in Capacitor.
There is a solution for that that may help you.
Doesn’t help me unfortunately.
See the link within my post for Capacitor solution.

based on the platform class documentation pause and resume are not firing
in browsers. documentation is here =>
The pause event emits when the native platform puts the application into the background, typically when the user switches to a different application. This event would emit when a Cordova app is put into the background, however, it would not fire on a standard web browser.

i think it is useful for you

this.platform.pause.subscribe(() => {

this.getLiveSession(); //i am calling this method while app running in background or sleep

});

1 Like

Doesn’t work in the browser or on Ionic React.