How to exchange data between MySQL and Parse.com? - mysql

We plan to use a MySQL database as the backend for our (Java or Ruby on Rails) based web application. After completing the web application, we want to port the application to iOS and Android.
We want to be able to run the application in "native" mode - that is, if a network connection is not available to the smart-phone, the system should be able to store the data locally, and sync with the backend when the network connection becomes available.
The best kind of framework for this kind of syncing is a library/framework such as Parse.com.
The question to which we want an answer is: is it possible to exchange data between the web application data stored in MySQL, and the Parse.com data which is stored in a proprietary format on the Parse servers?

Answer to your question: It is indeed possible, but syncing data is an advanced topic.
However, you also state that you want to access the parse data when offline. As I understand it, you want Parse to handle the offline state, and then sync to MySQL when connection is back up. Parse does not offer functionality to store data offline, other than caching requests. You probably need another service for your specific needs.
I might have misunderstood the use case. If so, my alternate understanding would be that ALL data for the smart phones will be handled by parse: both offline and online, with syncing. The answer is still: parse does not offer this kind of functionality.

Related

Flutter connecting to a database in server

I'm new to flutter and i really want to know, is there a way to connect to a database server (for instance mysql) in flutter rather using firebase. I'm working on a smart parking system project where i need to insert the latitude and longitude of the parking area which is free into the database which is created in server and retrieve it whenever user requests for it. It would be great if anyone gives solution for above mentioned problem (Flutter with database).
Since Flutter is just a UI Framework, topics such as persistence and databases may be out of scope or may depend on the use case.
Flutter UI's can persist data (application state) for short periods of time in a manner that is really only useful for the purposes of creating a good User Experience (is this button click? is it green? etc.)
For persisting more useful data outside of the application and on the actual device, you may want to consider the Shared Preferences Plugin for Flutter.
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android),
providing a persistent store for simple data. Data is persisted to
disk automatically and asynchronously.
Now, if you require persisting data in any centralized manner (e.g. RDMS, Firebase, or any data persistence service) your options are:
Persistence options that have a Flutter plugin (e.g. Firestore, Firebase)
Build your own service layer using HTTP, gRPC that talks to some backend service that provides access to a data store. You can do this with Express, Rails, CloudFunctions, etc.
As for connecting directly to a database such as MySQL, I don't see why you couldn't do that (maybe there is some technical limitation), but this would be a very bad idea in any practical situations as (unlike Firebase/Firestore) you won't be able to protect your data store once any client application has write access.
It sounds like you need a central read/write data store, so your best bet may be to host a server that provides access to a database while exposing an API to Flutter for which you can use dart:io to make requests.
Try using sqflite. It's a package you can include in your Flutter app that allows you to persist data to the local device. You will need to use the path_provider as well. Here is the link to the repository on Github https://github.com/tekartik/sqflite

Firebase Automatic Sync with Local PC

I'm working on a project that can take data from a Weintek HMI, put them on a webserver and then send them to an application that I created on android studio.
I've found firebase that can help me in this task.
In easybuilder that works with my hmi, I can create a mysql database that can store the data.
The problem is how can I update automatically firebase database with mysql database with an interval of time in order to access them on the android app.
If there is no solution with mysql, can someone suggest other method to extract the data and use some web server to sync it with the android app?
I don't know your specific need, in terms of data volume or application, but as a workaround, maybe this can help you:
I usually apply MQTT, which many Weintek HMIs have, to send telemetry data, and then use NodeRed to process and redirect the data to a database, email, SMS, Telegram, CSV, TXT... depending on the need , which in your case could be Firebase (I never used it).
It works great for me as I don't have to worry about HMI limitations.
The problem is the reliability of the data, in terms of confirming that when the HMI sends, the server listens and writes, but there are certainly ways to deal with this, and the fact that you need to have a server with NodeRed running.
If you have never done so, in Weintek HMIs you can send the MQTT payload cyclically using macros easily.

Expose "all changes since" via wordpress JSON api

I'm struggling to find a solution to what I thought would be a common requirement so I'm hoping someone can help me with some pointers on what to search for/areas to explore.
Background
I'm building an iOS mobile app. I'm storing data locally using realm.io. The app is preinstalled with a snapshot of the content of a Wordpress mySQL database (it uses custom types). The content of the WP database is only written via the Wordpress install, the mobile app cannot write data.
Objective
So, I want to be able to check for changes since a given date (whenever the local database was last updated) and send the changed records to the mobile app (via the wp JSON api?).
I think I can fetch "posts since a date" but I need a full list of all create, update and delete operations since a given date.
Since the app is read-only I thought this type of one-way sync would be pretty straight forward but I can't find a common solution.
Any ideas to point me in the right direction would be great. Obviously, if anyone has any experience of doing this sort if thing with realm.io then that would be amazing :-)
Realm doesn't support yet any sort of synchronization mechanism across different files. We have an issue about that though, but you're likely searching rather for a solution in the immediate future.
Update: Realm launched the Realm Mobile Platform. This offers synchronization functionalities and would greatly simplify the solution for this use case.
You could use e.g. the server-side Node.js binding to pull new data from your MySQL Wordpress installation and push them to a global Realm served by the Realm Object Server. This can be read-only synchronized from the mobile apps, which would automatically receive the deltas and provide updated data to your users.
Whatever mechanism you come up yourself though in the meantime, it would require that you have read-write access from your iOS application to the realm database, so that you can update it with new data.
Pushing changed records as you describe is likely not going to work.
Apple's Push Notification service (APNS), which is the only back communication channel that works when your app is in the background or suspended, allows you to send very small payloads. You would use that to signalize your iOS app, that something changed on the server-side and there is new data to load. You would then initiate a request to a JSON-based API, wait for the response, map the returned JSON to Realm objects and store them in your database.
You want probably read more in the "Downloading Content in the Background" section of background execution chapter in the official App Programming Guides for iOS.
While pre-seeding the database from the app bundle seems like a nice idea, because the user wouldn't need to wait initially after downloading the app, that will enlarge the app itself with data, which might become in the future completely irrelevant.

How to Make an Online / Offline Phonegap Application

I am investigating using HTML5 for a new suite of mobile applications that our company will be writing.
I found this demo here,
http://phonegap.com/start#android
Which shows how to use eclipse to generate and run an android application which is written using HTML.
Just wondering whether there is any information around about writing an online / offline application? This application would collect data based on the user input, and that data would be sent off to a central server and put into our central SQL server database.
What mechanisms could be used to connect and send the data to the server for instance?
Another requirement would be that some data would have to be sent and cached on the device, data related to the tasks that the logged in user has to perform.
You can interact with your server by applying traditional javascript techniques, like ajax, or other cross-domain methods like jsonp, iframes, etc.
The HTML5 localStorage will help you saving data on the local device, it's very useful when your data can be expressed as strings. But if your app requires more powerful tool for local data management, you can make a phonegap plugin with native code for anything you want.
In case of Offline-mode save the data in Local Storage which is feature of HTML 5. Whenever the user in Online Sync the data with the server. In case the data to be stored locally is quite large then use PhoneGap that allows to store some big stuffs
[Ref.: http://docs.phonegap.com/en/2.7.0/cordova_storage_storage.md.html#Storage].

Develop an iOS App that gets contents from a remote DB

I am developing an education app for Kids.
The application is going to contain pictures, stories and video as well.
Including all above contents in the app will surely bloat it and hence i would like store all data on a server that will be accessed by my app.
I haven't used any remote databases (like MySQL or Oracle) with any other iOS app. In fact i am a newbie in developing such kind of apps. Can any one point me to a sample
Connecting to a remote mysql is really not recommended.
The security here is critical.
You should create a webservice and my advice to you is to make sure that the access to the webservice is restricted
The webservice can be your own "protocol" or any other well known protocol like SOAP
By your own I mean, json, csv .... or whatever.
Edit 1
The technology of your webservice should be dependent on many things.
If the system is small, and the code needs to be update very often, I would suggest to do it with PHP and some small(!) MVC framework like CI.
But if its a large system with needs of ACL (access control list) I will probably choose java with spring...
I suggest that : Do not connect to / use database directly from user application. It may causes serious security problems and your app should have native SQL drivers to connect db.
So, create a web service that receive queries from the application and response in XML, JSON or some other strings that easy to parse. This will be much easier than embed native APIs into your apps.