4

My Android app uses a webview and page flow is mainpage.html -> listpage.html -> detailpage.html From detail page, I launch the camera intent to take pictures and add the taken pictures in the detailpage body.

But in certain devices running on low memory, staying on the camera interface for long time kills my app in background, so when I return by confirming on the taken camera picture, my app starts reloads from mainpage.

I have taken care of the below:

  1. android:configChanges="orientation|keyboardHidden|screenSize" and android:screenOrientation="portrait" considering if orientation change in certain devices is causing this issue
  2. android:alwaysRetainTaskState="true"
  3. Saving and restoring via WebView.saveState() and .restoreState(). However these methods no longer save/restore the display data for this WebView

Are there alternative ways so that either:

  1. I make sure my app is not killed in background
  2. I can save and restore exactly the display data for my webview

NOTE: Solutions give at Does WebView saveState() preserve Javascript variables/environment? are not working for me. As mentioned in Webview saving state of page and https://code.google.com/p/android/issues/detail?id=69334, webview's display data is not stored/restored

Community
  • 1
  • 1
  • 1
    Have you found an answer? – Anton Kizema Apr 25 '17 at 08:56
  • 1
    @AntonKizema No did not find a solution. Been old, I remember fixing this with a hack. Added a couple of session storage variables and used them to reload required data and populate the relaunched page with the required data. – Krishanu Ghosh Apr 25 '17 at 09:35

0 Answers0