I’m going to build a data driven Ionic app that has to be able to work in 100% offline mode. It is not going to require sending data to the backend, only reciving.
I need it to be able to sync json files and images with BaaS whenever online.
So my question is, which BaaS will do this the simplest way? I looked into Parse.com but they don’t seem to have a offline solution for JS. Also I looked into firebase but it seems to be mostly for realtime data, and basicly what I need is for the customer of the app to be able to add and edit event objects (with pictures) that then will be synced out to their customers devices when they are online.
I would prefer if the BaaS data editor is simple enough that the customer it self can add and edit data there so I don’t have to build a interface for that.
For such things i would not sync json files… it is more sharing data in json-format.
On device-side i would use a local database like the sqlite plugin for cordova… so you can easy access and using the db like a real db (for search, paging purpose).
I used this approach very simple --> i have a sqlite table with 3 columns:
- the requested backend url 2. the last json repsonse from the API as a json-string (JSON.stringify()) 3. the update-Date
Now you can build a unified api where you do not need to check if offline or online everywhere in your app.
This services looks, if you are offline --> and then makes a select-query for the original request-url
If you are online the live-api is used --> the new response and datetime is updated in the db
And i would choose https://www.firebase.com/ but it is not as simple as you want it to be.
And i would never let the customer directly edit the data… because they can destroy everything (good for you… because you can earn more money… but it is not a good approach).
For that you need a little custom administration area… where they can edit only the data they are allowed to.
There are some BaaS like where you can generate custom endpoints:
apiomat has an own javascript framework you can easily use in your app.
Thanks a lot for this info, that was exactly what I was looking for… Is SqlLite working for both Android and iOS and is it the best solution, what about pouchDB?
I get that it’s a bad idea to allow the customer to edit the data directly but its a low budget project and I don’t want to spend to much time on backend as the App is the interesting part and what brings me fame and women (or whatever
).
Not sure I get the apiomat idea, it seems to be for big enterprise systems…
It would be great if there where some cloud service where you quickly could generate a UI (for the customer) which could perform CRUD operations on firebase (og parse or what I end up using) through the REST api…
You can use pouchDB or forage to use indexedDB of the browsers as well, but this is only working correctly on Android 4.4+.
For couchDB there is the coax-Plugin for cordova apps to have something like a couchDB-Lite on your phone.
How many endpoints do you need?
Sounds like I should stick to SqLite then… Just need a single endpoint to fetch event data, at least thats the plan for now…
Maybe this is what you are looking for and it is free to for 3 APIs and 5 Endpoints
But you have to educate the customers to not destroy the endpoints ^^
https://restunited.com/pricing
I just want to warn against firebase. It’s AngularFire and JS/REST Api solutions do not have offline support right now. Their native SDKs have offline support however.
I wouldn’t do their work and sync the data with a local database because eventually they will come up with that feature.
Good service, just not good for ionic. I wish it wasn’t promoted on the web that much for ionic.