Open WuglyakBolgoink opened 3 years ago
Maybe Related to https://github.com/apache/cordova-android/issues/1000
Update: its looks like that cordova or android completely destroy connection to the app.
on Nexus connection to dev-tools stay always opened. on Huawei after click on on home-button connections will be emmidiately destroyed.
I actually noticed the same thing on a handful of different simulator tests with different versions of cordova-android (11 and 12).
Were you ever able to figure out how to get the app to not be destroyed when you send it to the background?
There is no way to prevent the app from being destroyed when it's entering the background.
The OS may destroy the app activity for several reasons. If the app is in the foreground those reasons are limited, but it's far more likely for the OS to destroy the app once the app goes in the background.
If the activity onDestroy
is called (as shown in the OP stacktrace) it means the OS has decided to destroy the app. More information on the android life cycle can be read here.
Note that natively there are ways to serialize/store view state so that it can be recreated later during the Create
life-cycle, however as far as I know, there is no way to serialize webview state. It is rather large issue with all webview-based applications.
There is no way to prevent the app from being destroyed when it's entering the background.
The OS may destroy the app activity for several reasons. If the app is in the foreground those reasons are limited, but it's far more likely for the OS to destroy the app once the app goes in the background.
If the activity
onDestroy
is called (as shown in the OP stacktrace) it means the OS has decided to destroy the app. More information on the android life cycle can be read here.Note that natively there are ways to serialize/store view state so that it can be recreated later during the
Create
life-cycle, however as far as I know, there is no way to serialize webview state. It is rather large issue with all webview-based applications.
Thanks. That's too bad. I can see the OnPause being triggered but then some destroy event is also being triggered afterwards. I'll take a look at the idea of saving the state.
Bug Report
Problem
Hallo guys! I found some problem.. maybe anyone can help.
with android “singleInstance” or “singleTop” after onPause my app was killed from system tasks. and then if I switched to the app again cordova do app restart…. How I can fix this?
tested on:
Huawei P20 Pro
-onRESUME
eventnot
firedNexus 5X
-onRESUME
eventalways
firedWhat is expected to happen?
back to the app and not restart the app after opening
What does actually happen?
Information
Checklist