Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11999] Android: localStorage not persistent in WebView when loading local resources

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-08-15T23:34:28.000+0000
Affected Version/sRelease 2.1.4, Release 3.0.0
Fix Version/sRelease 3.1.0, 2013 Sprint 04 Core, 2013 Sprint 04
ComponentsAndroid
Labelsmodule_webview, qe-manualtest, triage
ReporterBrian Burgess
AssigneeSunila
Created2012-11-30T13:44:57.000+0000
Updated2014-08-15T23:34:28.000+0000

Description

*Problem description* LocalStorage in the webview component on Android is not persisting data across app sessions when loading the HTML and related files as local resources. This is not consistent with iOS webview. *Suggestion* Seems like adding a 'WebSettings' property to the WebView to allow the settings of 'DomStorageEnabled' and 'DatabasePath' would do the trick simply enough. *Test case* See attachment.

Attachments

FileDateSize
localStorageTest.zip2012-12-05T03:05:55.000+00003661795

Comments

  1. Daniel Sefton 2012-11-30

    Could you put together a test case for this? Thanks.
  2. Brian Burgess 2012-12-04

    was my test case not enough?
  3. Daniel Sefton 2012-12-04

  4. Brian Burgess 2012-12-04

    I included a test case project in a zip file as a response to your email generated by your first comment. I figured that was easiest since it involved HTML5 in a webview on a titanium app.
  5. Brian Burgess 2012-12-04

    Also, I forgot to add that I did research this in Q&A first .. as well as posting my own Q&A question at: http://developer.appcelerator.com/question/145236/android-webview-localstorage
  6. Daniel Sefton 2012-12-04

    Hmm odd, I can't see a zip attachment. I've re-opened the issue. Could you try uploading again? Cheers.
  7. Brian Burgess 2012-12-05

    Did the localStorageTest.zip come across?
  8. Daniel Sefton 2012-12-05

    Am I right in assuming that you replied to the email generated by JIRA? If so, then that wouldn't have come through, no. You need to upload it on the issue page itself through More Actions -> Attach Files.
  9. Brian Burgess 2012-12-05

    ah I finally found the place to upload attachments. DOHH! My apologies for being so dense. -B
  10. Brian Burgess 2012-12-05

    I found it under Edit .. before I had only seen 'Create Sub-task' and 'Clone' in 'More Actions' :-S anyway .. is done .. finally. Thx -B
  11. Daniel Sefton 2012-12-07

    Tested and confirmed on Android Samsung Galaxy S2 2.3.6 with TiSDK 2.1.4 GA and 3.0 RC. Does not persist the values when you kill the app. Works as expected in iOS 6 simulator.
  12. Sunila 2013-02-08

    Set the properties DatabaseEnabled and DatabasePath on WebSettings to enable local storage. Tested in device and in emulator.
  13. Allen Yeung 2013-02-13

    Test steps: 1. Launch the app 2. Type in 'pizza' for value, and 'food' for name 3. Click on the 'setItem' button 4. Close the app completely (on 4.X devices, you can do this by using the recent app button, and swipe to the left to remove it. Otherwise, you will need to go to Settings > Applications > Manage Applications > localStorageTest > Force Stop) 5. Relaunch the app and verify that the food item is in the items list. Expected Result: The food item should be on the item list after relaunch Actual Result: The food item is not on the list
  14. Allen Yeung 2013-02-13

    PR: https://github.com/appcelerator/titanium_mobile/pull/3854
  15. Paras Mishra 2013-02-22

    Localstorage is persistent. Verified on : device : google nexus, android version :4.1 SDK version: 3.1.0.v20130220200300 CLI version : 3.0.24 OS : MAC OSX 10.7.5 XCode : 4.5.1

JSON Source