Pause and Resume events in Vue app

In an Ionic/Angular app I can capture the device pause and resume events via the events available on the platform service e.g this.platform.pause() and this.platform.resume()

In Vue (according to the Ionic docs) we only seem to have isPlatform and getPlatform methods and no events - how would I capture the pause and resume events?

hmm, maybe I need to use the appStateChange listener on the Capacitor App api https://capacitorjs.com/docs/apis/app#type-16

In ionic/angular, the pause/resume events are just proxies for cordova events,

      proxyEvent(this.pause, doc, 'pause');
      proxyEvent(this.resume, doc, 'resume');

Just so we can make them RX Subjects.

For Vue/Capacitor, the appStateChange can be used, but maybe ask if you need them at all?

2 Likes

thanks Mike. I need the resume event because there are some things my app needs to do when it resumes, in particular a back-end API call that we need to make every time the user re-opens the app