I am new to mobile app development. I am creating cross-platform app using Sencha + Phonegap. My goal is to store user-written text in mobile (offline storage) and some other text data related to it, that would persist even if mobile restarts, which would be then uploaded to server, once mobile has connection.
According to this http://docs.sencha.com/touch/2.3.2/#!/api/Ext.data.proxy.Proxy
Sencha provides 2 client side storages.
LocalStorageProxy - saves its data to localStorage if the browser supports it
MemoryProxy - holds data in memory only, any data is lost when the page is refreshed
MemoryProxy is out of question. And LocalStorage uses HTML5 storage and I dont believe that that lasts after reboot.
So what I need is some kind of database, which will be accessible from Sencha, on both Android and IOS, in offline mode. Is there such a thing?
Your assumption is wrong, localStorage is persistent between applications restarts and application reboots. Are you maybe confusing it with sessionStorage? As far as I know, data will be wiped out only if the user actively clears application data (for example on Android from the application menu).
Anyway, since you are using Cordova/Phonegap, you have these Storage options:
localStorage, key/value persistent storage (support table)
WebSQL, offers more full-featured database tables accessed via SQL queries (Android, BlackBerry 10, iOS, Tizen).
IndexedDB, more features than LocalStorage but fewer than WebSQL (only Windows Phone and Blackberry).
Plus you could use:
filesystem Cordova Api
The localstorage is persistent.
For example in android the localstorage data can only be deleted if the app deletes it, or the app is erased, or if the user goes to the setting and erases the app data for that one particular app.
Hope this helps.
Local storage is persistent. for better implementation you can refer this
:
http://www.sencha.com/blog/creating-an-online-offline-proxy-in-sencha-touch
Related
I'm making a story-driven app in Cordova. The problem is that whenever the app relaunches, it restarts the entire story. Is there a way I can set it so as long as the app isn't deleted it saves the exact progress? I haven't found anything online...
Because your Cordova app runs in the browser, you can use browser storage technologies like LocalStorage (basic kind of storage), WebSQL or even the newer IndexedDB. What I personally like to do is to use an abstraction layer like PouchDB (for offline syncing) or localForage.
If you choose to go the WebSQL way and want to store lots of data, consider Cordova plugins for WebSQL.
I need to develop an app for iOS with some basic functionality and since I'm not experienced with Objective C but with Web development, I need to know if it's possible to do it using Phonegap.
This app will be like a book with chapters that needs to be updated on a daily basis.
There'll be a CMS in a server where the content will be updated. Text and pictures.
The app will be running on iPhone and iPad that sometimes may not be connected to the network. When connected they need to check for updates and save in a local database to be available when off-line.
Is this possible using Phonegap?
Is there any local database in iOS like SQLite? Or do I need to store everything in files?
Can we save the text in a database and the pictures somewhere in a folder? Or everything needs to be saved in the local database?
What are the best plugins, features, methods that I'll need to look into?
You can use both LocalStorage and WebSQL in a PhoneGap app. LocalStorage is just... localStorage. Check the MDN docs for it. Ditto for WebSQL.
I am going to create an Android application using HTML5/jQuery and Phonegap In app Browser. I will display web page inside the In app Browser,
I want to implement the functionality that the user only enters his Name when he first time access the application.
I can save value using Phonegap's Local Storage but can't find how to access this value inside In app Browser.
Any help will be much appreciated.
Thanks.
Check the following documentation for more information
Is local storage for a Phonegap app on an Android device separate from the built in browser?
I just tested it but it seems like the inappbrowser and your phone gap app uses different localStorage as if they are two different browser instances.
I am working on a site for mobile devices. The site is available through normal web browsers and also through an app which is just a browser shell and brings up the mobile site. In our efforts to speed up the loading of the site in mobile we have reduced requsts, made use of data uris, etc. Recently we have started using localStorage to save styles and JavaScript data to the device.
Why you may ask?
In our testing, mobile browsers maintain their cache throughout their session and when the browser is closed and re-opened. The app maintains its cache as long as it is being used, but when it is closed and re-opened it re-requests everything, thus slowing down that initial load.
The problem is, we have styles and JavaScript that are specific for if you are in the browser or in the app for a few small things. We've seen a few things break around these subtle differences and my best theory is that localStorage is shared between the browser and the app. And a user that uses both the site and the app may have problems if the localStorage was set by one and needs something else for the other.
I can't find any documentation that confirms this theory or not, and short of creating an app just to test this I figured I'd ask if anyone has any ideas?
If you trust Apple...
Like cookies, storage objects are a shared resource common to web
content served from the same domain. All pages from the same domain
share the same local storage object. Frames and inline frames whose
contents are from the same origin also share the same session storage
object because they descend from the same window.
Because the storage resource is shared, scripts running in multiple
page contexts can potentially modify the data stored in a storage
object that is actively being scrutinized or modified by a script
running on a different page. If your scripts do not notice these
changes, you may not get the results you expect.
If you are populating your app with data from the same place as the web app, I would suspect there are some keys being modified by the other one. I know that using sessionStorage.clear() will wipe out keys if the web app and offline app load data from the same domain.
As Chiguireitor said it depends on what mobile OS the user is using, but in my experience iOS 4 & 5 share the same localStorage whether you're accessing the mobile app through the Safari browser or as a homescreen web app. And of course if you package it with something like Phonegap it acts as its own app therefore its localStorage is not shared.
To begin, I'm sorry for my awful english :)
I have a web application that will communicate frequently with a server running a
webservice offering JSON / XML. The application will send contact details / bills / products, and will have to manage an offline mode.
I thought to use this DOM cache (HTML5). However I must have constantly an updated customer list, bills etc. in offline mode because I can not make a request to the server.
It is therefore necessary to have an xml file on the mobile ... which will be read and modified. Is it possible and not too difficult to manage XML plaintext database with ExtJS (or another framework) on a mobile? (Android)
Thanks.
It's far easier to do with HTML5 storage, which you can use directly without the need for Sencha Touch API calls (providing you're on a supported device, iOS Safari supports web storage).
Have a read of this article from the Sencha blog.
Have a look at Lawnchair - this can be included in your app without a framework.
If you decide to use Sencha Touch you can use localStorage, which allows you to store key/value pairs in the HTML5 Web Storage on the device.
See this tutorial on the Sencha website. You could use localStorage to cache your json feed whilst making static assets available offline with a cache manifest file.