Also using Web SQL database there is the same problem...if I restart the device the data aren't preserved. I've a native app which load an html page with WebView.navigate, and I store data in this html page . If I close the app and then restart it...no problem to get stored data (both using localStorage and Web SQL DB), but if I restart the device, I lose all stored data . I'm using an Android.
Should I include a Config.xml to my app with some capabilities to preserve data? Or the only right way is to use Rhom?
Thanks a lot for any hint
1 of 1 people found this helpful
I don't recommend using WebSql since it's specification is depreciated and no further maintenance is planned http://www.w3.org/TR/webdatabase/. Is there any special reason why aren't you using Rhom?
Now answer to your question is Rhom the only right way? Well it's not the only way but it's quite strong and abstract so you can quickly add persistence data into your application. It can be quite fast when dealing with large sets of data when used properly. And the last thing is that you can use it with RhoConnect with little programming skills involved to sync with back end data. So my advice is to go with Rhom when building native apps.
well my will to use html5 localStorage is due to the fact that I've a web app deployed onto a web service and I access to it by my native app installed onto device using WebView. The app on web service already use localStorage to store data (a small amount of data), so I would have like to re-use it also when I access to it by my native app.
Anyway the strange behaviour is only when I restart device...the data stored are lost, if I turn off and then on the app, no problem!
I make some investigation yet, then I'll consider using Rhom!
Oh it seems you still want to use your existing web application on the server side in your native rhomobile application, your approach is in Rhomobile's term is Rhoelement-enabled Web App or Hybrid Approach, you could actually just use rhoelements runtime application (http://docs.rhomobile.com/rhoelements/rhoelements2-webapps) instead of directly creating a new native app.
But another choice for you is to migrate your web pages into internal ERB views in your rhomobile application and use the
Native Application Approach which will allow you to utilize Rhom.
But the second approach is of course not that fun, but it will give you additional access to device capabilities. I hope they could reall yfix the local storage API in rhomobile since it exist to do such job. Currently I did also encounter your situation but the benefit of the device capabilities push us to take the Native Application Approach, anyway you are creating a native application, why not take full advantage of its API, cause if not, existing browser would be better than your native app.
Luca, which device are you using?
LocalStorage and WebSQL are available in RhoElements for Native, Hybrid applications and Web Applications.
What I can suggest is to build a small native application that just check for the availability of the connection and then "navigate" to your remote webpage, as an alternative you can simply modify the start_path parameter in the rhoconfig.txt to your remote URL. This allows you to have a custom setup package (even for iOS) with your own icon.
I would like to use RhoElements but some device capabilities aren't available, hence my decision to make a native app...waiting for next RhoMobile release which seems to be promising!
Well I'm using these three devices: Samsung Galaxy S3 - Samsung Galaxy S Advance (both Android) and a PIDION HM40 (Windows Mobile 6.5): using RhoElements, localStorage works great, but if I try to use a native app, everytime I restart device I lose stored data . Is there any different about browser used between RhoElements and a native app? Did you ever succesfuly use localSorage in a native app?
What would you suggest to use to understand online/offline status in a web app? I seem html5 navigator.online isn't very reliable!
Thanks a lot
After spending more time in investigating about local storage issues , I have finally solved my issue, hope this will help you too, I posted an answer on other similar threads
Basically the cause is specifying the local server port in the rhoconfig.txt, so every startup the application wont randomized a different server port, thus will always be associated to one local storage path.