Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Android web view timeout/restart behavior

$
0
0

Update (partially solved)

I figured out there is a preference called "alwaysRetainTaskState", which according to android documentation does the following:

Normally, the system clears a task (removes all activities from the stack
above the root activity) in certain situations when the user re-selects that
task from the home screen. Typically, this is done if the user hasn't visited
the task for a certain amount of time, such as 30 minutes.

By setting android:alwaysRetainTaskState="true" restarts of the android app can be prevented in most cases.The app now still seems to restart every once in a while but much less often. For anyone who is interested in doing this in ionic/cordova, it's a little tricky since any modification of AndroidManifest.xml will be overwritten when recompiling the app. The way I solved it was by adding the line

<preference name="android-alwaysRetainTaskState" value="true">

to the android platform section of config.xml and using a hook to modify the manifest after build as described here https://gist.github.com/marcocarnazzo/6f01a57d390e8fe3071f


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>