Web mobile application with offline mode - javascript

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.

Related

Possible to remotely access files on mobile devices using HTML5/JS?

I have a file sharing web app online where I want people to be able to remotely access and upload files from their mobile devices without a client, but clientless via HTML5/JS, to our servers.
I have seem remote support companies log in to client devices just using browser with clients permission.
Thank you for your time
Robert
I have a file sharing web app online where I want people to be able to remotely access and upload files from their mobile devices without a client, but clientless via HTML5/JS, to our servers.
This isn't possible.
Web applications cannot access files that haven't been explicitly selected by the user. Additionally, they cannot store files on the user's system without a download, and they cannot do anything at all unless they are active in a browser -- they cannot run in the background.
Web applications running on mobile (i.e, Android or iOS) devices are even more limited. They typically cannot interact with most files on the system. For instance, web applications running on iOS can only upload photos from the user's photo library, not arbitrary files.
I have seem remote support companies log in to client devices just using browser with clients permission.
Either you were mistaken, or something else was going on. For instance, a client application may have been previously installed.
I'm not following exactly what you mean. If you already have the service, that means that you can just create a form with a filefield to upload whatever you want, the size limit is only imposed by your web server (apache/nginx/whatever) and your backend service.
You can complicate things a little bit using HTML5 web storage (that's what MEGA uses) but I can't give you any specifics if you don't explain a bit more in depth what you want to achieve.

Can I use IndexedDB in my Desktop Web application

I have being using typeahead.js in my web application. for those who don't know typeahead is a suggestion library which takes the data from you ajax call and shows its value in a drop down menu like google search engine do. it's quite impressive.
But now I am facing some issue data from ajax call is too heavy so that chrome cache unable to handle such a huge amount data. by going through google. I have found this IndexedDB API.
IndexedDB API which I came to know by googling. It store the data chrome browser offline instead of saving it in cache. please correct me if my understanding is wrong about IndexedDB.
So can I used it to store data client side browser. in my Desktop Web application.
Yes
You may use IndexedDB in your desktop web app, Its recommended especially for storing large JSON's
check out Progressive Web Apps Training Working with IndexedDB

Offline persisting storage in Sencha mobile app

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

Phonegap IOS App with local storage

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.

JavaScript Filewriter in FireFox

I need to allow users of my Web App to save files in their local file system after working on an editor implemented with javascript ( to work on a browser )
I heard about FileWriter API in HTML5, but not sure if it is supported in any of the Firefox versions, particularly FireFox 5.
Does anyone have any alternatives apart from Server side processing to allow users to save files into their local filesystem ( ofcourse with a permission from the user ) in FireFox. As I read Google Chrome supports FileWriter API though am not been able to make it work yet.
FileWriter is a Google working draft
Firefox team is working on implementing FileWriter also:
https://bugzilla.mozilla.org/show_bug.cgi?id=557540
No, Firefox does not support FileWriter, and the standardization of this API was abandoned (1, 2). http://www.w3.org/TR/file-writer-api/ now states:
Work on this document has been discontinued and it should not be referenced or used as a basis for implementation.
It seems that that API didn't even provide the feature you seem to be looking for:
The API doesn't give you access to the local file system, nor is the sandbox really a section of the file system. Instead, it is a virtualized file system that looks like a full-fledged file system to the web app. It does not necessarily have a relationship to the local file system outside the browser.
What this means is that a web app and a desktop app cannot share the same file at the same time. The API does not let your web app reach outside the browser to files that desktop apps can also work on.
You could use localStorage or IndexedDB to store the data client-side, albeit not in an arbitrary file the user can select via filepicker.
You could write an extension that provides the necessary API to content JS. As of 2015, it's unclear which technology you should use for that.
Downloadify (Adobe Flash initiating a download) is also often mentioned when discussing this. This thread mentions an alternative based on data: URIs.

Categories