question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android platform pause and resume events do not fire.

See original GitHub issue

Description of the problem: The platform pause and resume events do not fire. If I build the project using Cordova it works as expected.

constructor(private platform: Platform) {
    platform.ready().then(() => {
      this.onPauseSubscription = this.platform.pause.subscribe(() => {
          // Does not get here
        });

      this.onResumeSubscription = this.platform.resume.subscribe(() => {
       // Does not get here
      });
    });
}

Affected platform

  • [*] Android
  • iOS
  • electron
  • web

OS of the development machine

  • [*] Windows
  • macOS
  • linux

Other information:

Capacitor version: 1.0.0-beta.19

node version: v10.7.0

npm version: 6.1.0

CocoaPods version: N/A

Steps to reproduce: Run app on device. Put app into background by minimizing app or locking device Console.logs in the pause or resume events do not fire

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jcesarmobilecommented, Apr 24, 2019

Platform is from @ionic/angular, it listen for Cordova pause and resume events, which were not implemented on Capacitor.

I’ve added them now for better compatibility

1reaction
solojuve1897commented, Apr 22, 2019

FYI:

"Ionic Native is supported in Capacitor. Currently, Ionic Native contains only Cordova plugins, so whenever you find an Ionic Native wrapper you’d like to use, install it and then install the corresponding Cordova plugin by running

npm install your-cordova-plugin npx cap update"

https://capacitor.ionicframework.com/docs/getting-started/with-ionic/

Read more comments on GitHub >

github_iconTop Results From Across the Web

On Android, platform.resume and .pause events fire as soon ...
The logs will show that right after “doCall” is called the resume and pause events are triggered, at the moment the phone dialer...
Read more >
"pause" and "resume" events are not executing on Android
I determined a workaround to this problem. Although "pause" and "resume" are not fired on Android, the "visibilitychange" event is triggered ...
Read more >
Platform Pause / Resume events not firing in Capacitor
I was trying to use these events for my autologout timer functionality however I now realise that these events are not available yet...
Read more >
Cordova: Pause and Resume event not firing | Our Code World
In this article we are going to show the 3 steps that you're passing by and are probably causing your app to not...
Read more >
pause - Apache Cordova
The pause event fires when the native platform puts the application into the background, typically when the user switches to a different application....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found