Android app using Capacitor 3 is restarting every time it re-enters the foreground
See original GitHub issueDiscussed 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:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 😃 ?
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.