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 app using Capacitor 3 is restarting every time it re-enters the foreground

See original GitHub issue

Discussed in https://github.com/ionic-team/capacitor/discussions/5305

<div type='discussions-op-text'>

Originally posted by dchappelle December 9, 2021

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 3.3.3 @capacitor/core: 3.3.3 @capacitor/android: 3.3.3 @capacitor/ios: 3.3.3

Installed Dependencies:

@capacitor/cli: 3.3.3 @capacitor/core: 3.3.3 @capacitor/android: 3.3.3 @capacitor/ios: 3.3.3

[success] iOS looking great! 👌 [success] Android looking great! 👌

Issue

We have an app that uses the Quasar platform with Capacitor. Whenever the Android app is put into the background and then brought to the foreground again it is restarted?

  • This is not a problem when using Capacitor 2
  • I’m using android:launchMode=“singleTask” in the AndroidManifest.xml
  • The iOS app is not restarted
  • It restarts on a real Android device or emulator

Here are the logs I’m seeing…

D/Capacitor: App paused
D/AAudio: AAudioStream_requestStop(s#1) called
D/AAudioStream: setState(s#1) from 4 to 9
D/AudioTrack: stop(274): called with 348296 frames delivered
D/AAudioStream: setState(s#1) from 9 to 10
D/Capacitor/AppPlugin: Firing change: false
V/Capacitor/AppPlugin: Notifying listeners for event appStateChange
D/Capacitor: App stopped
D/Capacitor: Saving instance state!
I/Capacitor/Console: File: https://<domain>/app.js - Line 5042 - Msg: [capacitor] - appStateChange, active: false
D/AAudio: AAudioStream_close(s#1) called ---------------
D/AAudioStream: setState(s#1) from 10 to 11
D/AAudioStream: setState(s#1) from 11 to 12
    ~AudioStream(s#1) mPlayerBase strongCount = 2
D/AAudio: AAudioStream_close(s#1) returned 0 ---------
D/Capacitor: App restarted
D/Capacitor: App started
D/Capacitor/AppPlugin: Firing change: true
V/Capacitor/AppPlugin: Notifying listeners for event appStateChange
D/Capacitor: App resumed
I/Capacitor/Console: File: https://<domain>/app.js - Line 5042 - Msg: [capacitor] - appStateChange, active: true

Any help would be greatly appreciated!</div>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dchappellecommented, Jan 31, 2022

@jcesarmobile I found out that the jcesarmobile/ssl-skip Capacitor plugin for skipping ssl checks is causing this behavior . Any chance it can be updated not to reload the page when coming back from the background 😃 ?

0reactions
ionitron-bot[bot]commented, Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My ionic app keeps restarting instead of resuming from last ...
I am using angular/ionic 5 and I don't believe this is an issue angular/ionic router since this works fine in pwa/browser versions of...
Read more >
Optimize for Doze and App Standby | Android Developers
At the conclusion of each maintenance window, the system again enters Doze, suspending network access and deferring jobs, syncs, and alarms.
Read more >
App Capacitor Plugin API
The App API handles high level App state and events.For example, this API emits events when the app enters and leaves the foreground,...
Read more >
Fix an Android device that's restarting or crashing
Try the following steps if your phone has any of these problems: Randomly reboots or restarts; Shuts down without restarting; Restarts constantly: Go...
Read more >
Firebase push notification badge count - Seba Online
Notification Count Badge in Android App Icon 400. ... Jul 05, 2018 · 3. ... In Houston, you can re-send the same push...
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