I am creating my first mobile app using Phonegap and I am not sure what database to use with it. I have read a few articles and am finding it hard to decide on which is best to use. Two of the ones mentioned most seem to be MongoDB or SQLite
Because PhoneGap needs Nodejs, I thought that MongoDB would be a good option but is that too robust? I am familar with Mongo but don't want to choose it just because it is convenient, I would prefer to use what is best.
The app will hopefully store information both locally and on the server. Will probably be information like you would store for a messaging app - user info, contacts, messages etc.
Anyone know which would be best to use? - or if another would suit my needs more?
The phonegap is a framework that allows you to create mobile applications using API's multi-platform web. The choice of the database in my view
should not be given by the framework, but for what kind of application you are doing.
I see three ways to store data from your mobile application.
1: Local Storage (http://www.w3schools.com/html/html5_webstorage.asp)
2: SQLite (https://github.com/brodysoft/Cordova-SQLitePlugin)
3: Database on server (can be anyone.)
The choice will depend on what you want from your application. If it is a simple application that will be stored few data, use the local storage of html5 that stores documents. If your application is already a bit bigger and more complex, you can use SQLite implemented in the browser using HTML5 which is supported by most current mobiles browser. The advantage here is that access to the base is done without the need to build a server. In the third case your application would be the type client server, in which case you should use the database on the server. The choice of database can be what you feel is appropriate.
I suggest you go with IndexedDB if you want to store a lot of data in the client or LocalStorage which is able to store 5MB worth JSON data.
This is just the front end but for the back-end there are so many to choose from and if you plan to write the back-end with Node then it will be wise to use MongoDB.
I would suggest using the Cordova-SQLitePlugin as it offers a native interface to sqlite, avoiding quota restrictions associated with WebSQL on mobile devices. The plugin is supported on Android, iOS and Windows Phone 8 platforms.
If you want to keep a local and remote database in sync, you may consider using this in conjunction with PouchDB
PhoneGap can use LocalStorage, SessionStorage, or SQLite databases. You can also use PhoneGap to connect to the devices native classes via a plugin, and pass the native class data, that it will then store on the device. check this link to find more details
What database does PhoneGap use and what is the size limit?
Related
We wanna create an app that is offline-fist. We're trying to use or create an auto sync database that allows work offline with app. Our client is Flutter and our back-end is Yii2. What is the best solution?
I have developed multiple offline sync applications. I can not tell you about the backend much but I can tell you about the Flutter.
For storing data on your device there are multiple plugins you can use.
sqflite-: It works well in android and ios.
shared_preferences-: If you want to support all the platforms then you use shared preferences but there might be some security issues here.
For Auto-sync
You can use the internet checker and sync your database with live.
connectivity_plus-: Works well but sometimes it does not trigger the callback for connectivity. (work well for all the platforms.)
Note-: This plugin does not give you if the internet is working or not.
internet_connection_checker-: work well in all cases and also provides if the internet is actually working or not.
If you want to sync when the app is in the background then you may need to use
background_fetch
Happy Coding ;)
I'm looking for advice if it is possible to use server based database with the onsen/monaca framework? I know Monaca has its own backend database that can be utilized; however, I intend to not have my project's database cloud based.
Initially, I would have used mysql or mongodb if I was working with Php/javascript, but given I want to make hybrid phone app using onsen/monaca, I don't know if I can go the same route. I'm new to onsen, and I am still learning.
Onsen is simply a UI framework or in short, a very fancy collection of html, css, and JS. It is compatible with any database you use. You would need to utilize JS to connect to some server-side language like PHP or use Node.JS that would actually connect to your remote database. Hope that helps!
Local databases, on the other hand, have to do with the target device and phonegap than Onsen. The most common plugins support SQLite.
Hey I'm making a small project and I would like to use a JSON style database service where I can set and get parts of the JS object. I would like this to be completely on the front end and not require any server technologies. It dosent need to be secure as its just a hobby project. Security is a bonus.
I'm currently using HTML5 local storage.
I'm happy to pay for this as a service.
Update 2020: A lot has changed on the internet since this question was asked. I would recommend:
Google Cloud Firebase (https://firebase.google.com/)
It has an authentication mechanism built in
It has user management
https://www.firebase.com/ does not have free plan.
Direction to go seems to select NoSQL db like MongoDB or CouchDB, and then search/compare for db as service providers.
Quick search gives 10 Online Storage APIs
That is file oriented APIs
Adobe Share: Recently released online document sharing service from Adobe with a REST-based API that integrates with Flash, AIR and non-Adobe applications.
Amazon S3, Simple Storage Service: Probably the best known storage API and a key element of Amazon’s pay-as-you-go infrastructure services.
Box.net: The “Box Enabled” platform offers a choice of SOAP, REST or XML-POST APIs. Below is Fireloader, a Firefox extension which allows you to upload, and download photos, files and videos using a familiar FTP like interface. In this version Flickr, Picasa, Box.net and Youtube are supported.
Cellblock: This multimedia sharing service offers a REST-based API.
MoveDigital: File delivery and management services geared towards large files.
Nirvanix: A newer entrant into this space, focused scalable, secure storage through their Storage Delivery Service (SDS). See their feature comparison vs. S3.
Omnidrive: A well regarded REST-based API which has been used for a variety of interesting commercial integrations including direct access from Zoho.
Open XDrive: AOL offers this storage serviced using a JSON-RPC protocol.
Openomy: Experimental online storage service started in 2005 (although a quick check of this service over this past week indicated leaves some question about its current operating status).
ref https://webapps.stackexchange.com/questions/8247/seeking-online-hosted-database-web-service-with-rest-api
amidb provides hosted json service backed by elasticsearch and cassandra.
Try it out. It is free to host files and json. you only pay when you go into production.
disclaimer: I'm involved as an engineer with http://amidb.com
Here are a few options:
myjson
jsonbin
They all currently have a free option.
You may also want to check out www.ttmsolutions.com/restjee. Its a lightweight server-side JSON ORM that doesn't require you to develop any server-side code and works with any DB.
You could try https://jsonware.com You'll get a fixed URL with your JSON.
It can even generate random data. No installation is needed.
I am developing an mobile application which can be run on mobile devices (with OS like Android, iOS, WP7...). This application will get data from online database then store them to local database in device and I can do CRUD with data. There are three ideas:
I'll create a webservice to handle with database on host and use some cross-platform framework to building an app then connect to webservice in order to get and put data to server. Issues:
Which technology should I use to create webservice? (RESTful/SOAP...?)
Which type of return data for easy to handle? (XML/JSON...?)
How to sync between local database and database on host?
I'll make an application for loading an external URL and build a website (with all of features that I need to work with database). Issues:
iOS, Android, WP7... accept for loading external URL in applications?
How to sync data like my first idea?
Should I use single page application technology?
I'll make an application using cross-platform framework and it will work with local database. I just handle syncing between local database and host database. Issue: which is the best database and best framework to do this?
Thank you
How to sync between local database and database on host?
For synchronization, you can take a look at the open source project, OpenMobster's Sync service. You can do all types of sync operations
two-way
one-way client
one-way device
bootup.
Besides that, all modifications are automatically tracked and synced with the Cloud. You can have your app offline when network connection is down. It will track any changes and automatically in the background synchronize it with the cloud when the connection returns. Also, when new data is created in the Cloud, it is automatically synchronized with the local database using Push notifications.
Currently only native development is supported on Android and iOS. However, the next release which is 2.2-M8 (end of March) will support end-to-end integration with PhoneGap on Android and 2.2-M9 (end of April) will add iOS.
Support for PhoneGap will give you the flexibility to build the app using web technologies like HTML5, and JavaScript along with Sync for your local data using OpenMobster.
If you want to go pure native, then you still can use the Sync service and synchronize your local database with your remote database.
Let me know if you have more questions about the framework
Here is a link to the open source project: http://openmobster.googlecode.com
Good Luck!!!
Some suggestions:
If you're planning that your mobile application exchanges data with a server, i strongly suggest you to use RESTful Services. The XML overload associated with SOAP services might get your phone and your network into trouble
The return data can be either JSON or XML. For example, in Blackberry applications i prefer XML because the support included in the SDK.
There are three kinds of mobile applications: Web applications (build with HTML/Javascript and accessed throw a Browser), Native applications (installed in the device and coded in Java/Objective-C or another language) and Hybrid applications (installed in the device but coded in HTML/Javascript and can access some features of the OS). Your URL-Loading type sounds like an Hybrid approach (not quite sure about that), so you can use PhoneGap to build that type of applications.
Hybrid and Web applications uses the capabilities of the phone browser to manage HTML/JavaScript. Now the devices come with very powefull WebKIt-based Browsers, so the single page pattern would work with no problem. Although, it's kind of a wear approach to mobile application design.
I don't see the need of a local database in your app, you can simply handle all the data in the server and access it through RESTful Services on the phone.
I am developing an mobile application which can be run on mobile
devices (with OS like Android, iOS, WP7...). This application will get
data from online database then store them to local database in device
and I can do CRUD with data
Nice!!!
Which technology should I use to create webservice? (RESTful/SOAP...?)
I Will go For REST services.
REST has advantages when:
You have a set of resources that you want to manipulate.
You want to support navigation between resources.
You need scalability.
SOAP has advantages when:
You want to publish a web service description (using WSDL).
WSDL 2 can describe RESTful web service as well. WADL is an alternative to WSDL for RESTful web services.
You want to use security etc. that relies on the use of SOAP headers or some similar mechanism in which data is added and removed from a request.
You want better tooling support.
You want tested platform interoperability.
Which type of return data for easy to handle? (XML/JSON...?)
I personally go for XML
Its not a criteria of which is easy to handle.Its about performance in Mobile applications.
JSON is generally smaller than a XML document and there for faster to work with.JSON can be parsed more efficiently because it can be parsed as JavaScript, which the built-in eval() function will do for you.
How to sync between local database and database on host?
Create a service which contains a timer and runs in background.Call the REST service at intervals to get the latest values. But Since this is a polling kind of thing,then it is not efficient and has less performance. Other Approach will be use of PUSH notifications.As soon as there is any change at the server side, send a push notification to the client(mobile) and hence perform the local database operations.
iOS, Android, WP7... accept for loading external URL in applications?
I didn't understand this point.What you want actually?
Should I use single page application technology?
Single page technology is very good.But it will depend on your business.If it is possible then use it.Else create different HTML pages.
I'll make an application using cross-platform framework and it will work with local database. I just handle syncing between local database and host database. Issue: which is the best database and best framework to do this?
Choosing of the database will depend upon choosing of the cross platform mobile framework.Phonegap is exactly what you need. And the database will be sqlite. Phonegap provide API's for storage,so you can easily access the database of the different mobile platform.
I need to make a couple of mobile applications which will all access a shared online resource using e.g. REST API.
What is the cheapest/easiest setup for the server side resource?
The server should store data as either xml/json/sqlite and expose an API to access this data, preferably in a secure manner.
Is Google App Engine appropriate? Any others?
What would be a recommended way to implement?
What I want to do is to have a database online (not important which format - content will not bee too big, ~5000 records with around 5-10 text fields each), have a simple management console for editing this content and then let mobile devices connect in order to check if they have the latest data and update if required.
The data should not be publicly available but key may be hardcoded into device applications.