I am dsigning an app for iOS using phonegap. What I want to do is log down the date and time each time when the user pressed a button on the screen, and be able to view the log on device screen with an admin access. I know I have to create some sort of a database to store the info, but can someone give me an example on how to create one as I'm new to phonegap and not sure how to do that.
In my opinion the best SQLite Plugin for saving a lot of data is this plugin:
https://github.com/brodysoft/Cordova-SQLitePlugin
There is no limit of storing. In this post How to compact SQL instructions in Cordova? I have written how to compact SQLite instructions, so you have not all this event overload.
But do you really want save every tap? That will be a lot of scripting work.
It seems as localStorage would be sufficient for your problem. You can simlply Json.stringify your data and put it to the local storage. Later get it from there and json.parse it. No phonegap needed just pure html5. Try search for localstorage HTM5
Related
I want to do an app with ionic framework and cordova for Android and iOs and I want to optimize at most the requests to the server.
I need to get data from php server (API) and store in the mobile phone, this data is related, so I think that a SQLite is the best option to store it in the device because of to show it is more fast to do a complex SQL than get a JSON stored in localstorage (for example) and search and link the data in the mobile. I'm right?
I need to do this and can do a Pull to refresh in the app and get only new data.
I've been watching some solutions but I don't know what is the best.
Parse/Firebase: This is difficult to administrate for non-specialists, for this I have a backend to enter and modify data with the relations easily. In addition this services return a JSON with more data that I need.
Persistence.js and Persistence.sync.js this works with mysql-server and sqlite-local but can I sync only one table or get only the new data? And I did't find a solution for php server.
CouchDB and PouchDB: I don't know if this can be sync only for a new records.
Receive data in JSON and store it in SQLite: I need to create functions to do this easier.
Any other solutions?
I'm very lost in this topic.
Thanks!!
CouchDB and PouchDB: I don't know if this can be sync only for a new records.
That’s the default. Plus they handle all the nasty sync details for you. Would highly recommend looking into this.
I have a requirement to create a mobile app that has the ability to queue up records that need to be saved when no internet connection is available and update the data via web api when a connection is available in our SQL Server DB.
I'm trying to avoid having a local version of the DB on the device which I've seen some others recommend in other questions on stackoverflow.
The approach I'm going with right now is to try and save the records in a local store (JSON) while there is no connection. Then to try and hook in some event to know when the connection has been re-established to update my data to SQL Server.
I'm just wondering what the best practices are around this? Are there issues with my current way of trying to solve this problem?
We are using DevExpress's DevExtreme mobile solution with Visual Studio 2012 and Cordova PhoneGap.
Any advice would be very much appreciated.
How big is the JSON data that you want to store, likely to get?
Depending on your answer, you could store it (the JSON data) in localStorage and then write it next time the device is connected.
I'm making a PhoneGap app that needs to store some user data. On the initial app startup, the user will be asked to type in a URL. Because the URL may potentially be long, I wish to save it on the user's device so the he doesn't need to re-enter the entire string every time he starts up the app.
Initially, I was planning on using LocalStorage for this. However, I've heard that LocalStorage doesn't save data very permanently. It would greatly hurt my app's usability if the user had to type in the URL more than once every month or so.
Should I use SQLite instead of LocalStorage for this purpose, or is LocalStorage reliable enough on most mobile devices for this kind of usage?
You should'nt use LocalStorage because it's no longer a persistant storage on IOS since 5.1 and also because Apple can reject your application.
You have several choices :
Using the File API
Using WebSQL (5 Mo max i think)
Installing the SQLite Plugin
For the last choice, you can also install Lawnchair (included) which provides an easy to use key value system on top of SQLite. You won't need to write any line of SQL to use SQLite.
How can I do that?
To start with, planning to save it into the HTML5 local database using IndexedDB? May be later on I can save it the user's table in the database.
Is this the right approach?
if they will be using the search on multiple devices save it on the server side. that way they get their complete search history. if not go with local.
do not forget to have a mechanism to purge the search queries on a user action.
Indexeddb is not design for that kind of usage. It is better of with usual http caching.
Indexeddb is design for storing full table and query client side itself.
I am using Google Map API to do address translation(mainly by geocoder).
And I'd like to store results into local database for future use since google map has a limit on total query number and frequency.
But how? I have googled and found an ActiveX based solution. Is there platform independent alternatives?
To access a database you are going to need a server side language. JavaScript can talk to PHP through AJAX and PHP can update the database with whatever parameters you give to it via JavaScript.
I would stay away from ActiveX as it can be tricky and you just dont need it.
When you have a database setup, have a look at these websites
http://www.tizag.com/mysqlTutorial/mysqlinsert.php
http://api.jquery.com/jQuery.ajax/
Current in-browser database options include IndexedDB, Web SQL, and Web Storage.
Browser support, however, isn't all that good. Web Storage is your best bet, but it won't work on IE7 and earlier.