January 19th, 2013, 04:46 PM
Transferring HTML5 locally-stored data to another device for parsing?
I am creating a very simple "app" using HTML5. It's basically just a tally system (click an item, +1 to that item's numeric value), with some simple arithmetic rules and variations.
I'm using HTML5 so that it can be used on a variety of devices -- it has to be mobile. Ideally I would like the device to run the page from a local/offline HTML file. (No web hosting, no SQL, etc.).
At the end of the day, the tallied data has to be transferred to a desktop computer for pasting into a spreadsheet-like desktop application.
Is there a simple-ish way to pull HTML5 local-storage data from a tablet or smartphone's browser, and parse it on a PC? (Or to "export" HTML5 local-storage data to a .csv or other file format that is easily parsed on PC?).
Any suggestions would be appreciated.
P.S. Even though I would prefer to avoid hosting the "app" online, I would be willing to use a Google Docs spreadsheet as the "middle-man" for this data.
January 20th, 2013, 11:04 AM
There is no simple way of doing that of which I'm aware.
The easiest way, both from a user perspective and from a programming perspective, is to have an online service to which they can sync the data and then download it. For example, have a sync button in the app which transfers the data to an online service. Then, on their desktop, the user visits the online service and can download the data. Google Docs will not work as a middle-man for that.
When the phone is directly connected to the PC there is no API or anything like that that you would be able to use to retrieve the data. The device would have to be set in a mode that allows file access, your program would have to locate the file on the phone's memory that stores the data, and then it would have to parse and extract the data directly from there. The first one is a challenge from the user's perspective, and the second two are a major challenge from the programmer's point of view. This is especially difficult if you need to support multiple devices, and even more difficult if those devices are running different OS's. Additionally on some devices this may just be flat-out impossible because they don't allow file access to the files containing the locally stored data.
If you were building a native app you would have more options available. For example, you could have your desktop program start up a server, broadcast its existence to the network, have the mobile app listen for that broadcast, then have the mobile app transfer the data directly to the desktop program over the network. This would require the device to be connected by WiFi to the same LAN as the PC.
Android also has a "Share File" functionality that apps can hook into which would let your mobile app generate a file and then let the user choose how to transfer it - for example, they could e-mail it to themselves, or load it into their dropbox, etc.
January 24th, 2013, 07:46 PM
Thanks for your response. I guess I'll have to bite the bullet and figure out a basic system for syncing to a server. The app is mostly for my personal use so I can use my personal website for now.
What is a simple-ish-to-learn system for syncing simple data from a browser to a server? One of these days I should probably learn SQL but for the moment I think it's overkill. The data I need to sync is basically the equivalent of a one-page table -- no complex relationships or queries required. All I need to do is:
1. Enter the data in a simple web form I've created for my tablet
2. Send the data from my tablet to the server
3. Access the data from my desktop browser, and export as CSV or something I can open in Excel
I'm pretty sure I can figure out steps 1 & 3 on my own, but I don't know where to start with step 2. Any suggestions would be appreciated.