Start a new topic

Architect breaking window.localStorage on Android?

Architect breaking window.localStorage on Android?


After launching WikitudePlugin.loadARchitectWorld('smt') I get SECURITY_ERR: DOM Exception 18 when i try to access my window.localStorage. Not happening on iOS and not happening on android outside architect even when I "jump around" with window.location.href. 

Google-fu on above exception din't do it. I can boil it down that is is only happening on Android (various versions) whin Architect.

Anybody? 

 

So the workaround is to use WikitudePlugin.callJavaScript(smth) to pass paramters the architect, BUT (it seems) that on slow android devices the startup of wikitude takes too much (over 12 s in general on some of my devices) such that callJavaScript ends up in no-man's-land. How do I pass parameters to the architect safely? The local storage is broken (by the webkit implementation of google I guess) and callJavaScript is not reliable, as far as I can see it. 

Thx for any answer. 

Hi Lukas,

Thanks for your post.
Yould you please provide us


Sample Code so we can reproduce the issue you described, whole phonegap project would be perfect (please send to android AT wikitude.com with Subject "Forum Post Window.LocalStorage"

Information about the affected device and OS version


We'll then have a close look if this is a phoneGap issue or affects also native Android SDK.

Thanks for your help.

Kind regards,
Andreas

Hi Lukas,

Do you have same issue when using our Wikitude App with this low-end device?
Wikitude is based on the SDK and uses callJavaScript() for POI and traslation injection too.

In case you don't have problems with Wikitude please re-check your DOM-injection approach.

Best regards,
Andreas

Hi Anderas,

thanks for your outstanding support. 

At the moment I can't send you my project, but the issue should be reproducable with an Example-App:

1. Lanuch Architect on an slow Android Phone (maybe a big img-db helps, not sure). In my case its a Samsung  GT-S6010 with Android 4.04. A similar issue was described also on an iPod, but I cant confirm it at the moment. 

2. Run WikitudePlugin.callJavaScript(smth). In my case I run DOM-injections (using jquery mobile) to "translate" buttons the the language a user selected in a prvious screen.

I can confirm window.localStorage not working in Wikitude (ARWorld) under PhoneGap on Android - works fine on PhoneGap on iPhone.

Created workaround using url-navigate + callscript backed by PhoneGap SQLite. A lot of coding just because of missing localStorage. Drawbacks; Since both url-navigate and SQLite are async I have to read full table into local array upon startup to avoid having async code upon every single read to (my custom) localStorage. So the full content of "localStorage" has to be in memory at all times, which is very bad for caching map tiles. Delta is written back to SQLite via PhoneGap upon change has to be both serialized and urlencoded/decoded.

So all in all, some localStorage support would be very nice. :)

To test simply create a world that do something like:
localStorage = "bar";

This is an issue of the Android WebView, and can't be fixed.

An explanation is here: http://stackoverflow.com/questions/8390985/android-4-0-1-

If you are loading your AR world from the local resource folder, this is considered insecure, and the WebView cannot access cookies or local storage.
This behaviour changed with Android 4.4.
Login or Signup to post a comment