Cross-Platform Mobile Application Solution - database

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.

Related

What technology to deploy RESTful Server with SQL+COM capability

We're developing a cloud based web application for customer management. One of the main goals i the capability to connect to different local applications on the customer endpoint.
As example, we don't want to have a customer database in out application, the customer should be able to search within his local ERP system right away.
What we need is not much. Only a client on the customers server with access to the local SQL server as well as the COM model.
But as webdevelopers and mainly going with PHP the question came up, what technology we should use?
I've got two approaches in mind:
NodeJS
Lightweight, Javascript and with the Express and winole32 extension we should have everything we need. But the deployment and installation as a service seems to be a bit wacky.
C# .Net Web API
Also a good approach I guess since the client servers are allways windows. But is there a way without IIS?
Or do you have something completely different in mind? It should be very fast and compact. So its basically just a RESTservice that can be deployed with ease.
Thanks for your inputs and thoughts.
C# .Net Web API Also a good approach I guess since the client servers are
allways windows. But is there a way without IIS
It is called OWIN and it is properly documented (web api self host is a good keyword) and works like a charm. Using that on various services to expose an API into the service.

What database to use with PhoneGap

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?

Architecture for mobile application

Right now ,i and my friend looking forward to make a mobile application, which is going to get data from several different sources, analyze it with some kind of algorythm and make the best decision on that. The main problem is - right architecture for that. We consider that mobile application is going to be just a client, representing data placed somewhere on internet (anyway internet is required).
Can u help us with making right choice?
We have some kind of knowledge about client-server architecture with sockets... But this is definetly not we need in this particular situation.
Our thought is to make a web site which is going to generate all the required data.After that implement mobile apps which will represent info from website, using convenient interface. Is it right way?
Yes, that's the way to go.
Now, you have several options within that architecture...
server gets data from several different sources
server might expose some kind of RESTful API to the client apps
clients can be native mobile applications or client might be html5 mobile apps
depending on the nature of the data, you might want to consider some kinds of caching data that you get from 3rd party services/sources
EDIT:
I use ASP WebApi to build REST Api that serves json data to android mobile app.
So, my infrastructure is:
- MS SQL 2012
- ASP MVC 4, WebAPI
- android mobiles (we're targeting mainly Jelly Bean & Kit Kat)
I've built n-layered application with layers (bottom up order):
- DAL (i don't use any ORM framework...i use my own repository that runs stored procedures on SQL server)
Repository that wraps around db DAL and a few Service Agents that gets data from 3rd party services we use
Business layer where i do our business operations
Service layer (for now, it has no special use but afterwards i might need it as my business layer will be consumed from a few clients: WebAPI, web site, windows service...)
WebAPI for REST where mobile client requests end up

What is a web service?

Could someone please explain to me in a simple way, what is a web service?
Please correct me if I'm wrong. I have a DB hosted somewhere in the web, and I want to perform DB transactions from a desktop application as well as a mobile application. Can this be done through a web service ? Someone mentioned it to me and I wanted to make sure this could happen.
Here's a good explanation on Wikipedia.
A middle dynamic content processing and generation level application server, for example Ruby on Rails, Java EE, ASP.NET, PHP, ColdFusion platform
The middle tier of a 3-tier application is often the web service
i want to perform DB transactions from a desktop application and a mobile application, can this be done through a web service ?
This is Exactly what a web service is for.
A web service allow you to create multiple front ends if needed, and serve your database data to all of those front ends. You can also open up the API and allow third party developers to access the web service and thereby access the data of your application in a controlled environment.
It's considered a better practice for larger applications to access a web service or a middle tier rather than directly access the database.
In your case, a web service would involve setting up your DB behind a web server that listens for incoming requests, performs the appropriate DB operations, and returns whatever data is appropriate. Then, your desktop and mobile applications could send a http request and the DB would respond appropriately. This would let all your applications access the same DB.

What would be the best solution for having a mobile application store/retrieve/update data

I'm developing a web based application built on codeigniter which will also have a mobile application(blackberry, iphone, android etc.). The web application will be connecting to a (mysql) database to store/retrieve/update data. I would like to know what would be the best solution for having a mobile application store/retrieve/update data.
Taking into consideration performance, flexibility, Security
Look at your device no different than if it was a browser. The are both clients. All devices (well at least Android and iOS) provide you with ways to make xhr requests, just like your browser does. So you need an API on your server that your device will use to get the data. Note that if your application does not already have an API, you will need to develop one.

Resources