Synchronise a mobile light database with ASP.NET Web API 2 - mobile

I am building a mobile application targeting iOS, Android and WP with Ionic/Cordova. And using ASP.NET Web API 2 REST APIs backend.
I have the requirement that the mobile application can collect data and synchronise it with the APIs and if the mobile is offline, the sync will happen when it is online. The data size is small and any light DB would do including the localStorage one. The required sync is only needed one way, mobile to APIs. Also, once a record is synchronised, it can be deleted from the mobile.
I was looking at Couchbase mobile, but I found it is a Mobile DB to DB sort of a solution.
Can you recommend a mobile DB to REST/Web API sync solution?

With the native Couchbase Mobile solution for Android/iOS coupled with the REST APIs you are able to get data from Mobile device to your backend. Then delete any documents off your device once you get back a 200 status.
For Windows Phone, you can explore using PouchDB or going with the javascript browser based solution across all platforms since WP is not currently supported.
For the replication or sync to occur when your device is online again, you would require your backend to use Couchbase Server and implement the replication class methods in your native mobile app to have the push feature. Or you can use the REST API with logic detection when you are online again to POST to your backend.

Related

Amazon Mobile Hub vs a custom backend vs Parse

My app was built using Parse as a backend. My understanding is that the plug-and-play architecture of Parse is limiting - that the services layer that should be used for business logic doesn't exist or is limited. Now I'm debating whether to build a custom backend or to use Amazon Mobile Hub. My concern though is that if I chose Amazon Mobile Hub I will run into the same services layer issues I experienced with Parse.
I'm wondering if my assumption is correct: does Amazon Mobile Hub have a non-existent or limited services layer?
I would suggest you to try AWS Amplify https://aws-amplify.github.io/

Where do I keep the application logic in an offline-first web app?

I'm trying to build an offline first web application using couchdb and pouchdb as the backend/frontend databases, AngularJS as the frontend framework and expressjs/nodejs as the backend server. The problem is that what I'm used to is the backend-MVC mindset of building web apps, and not to SPAs, offline-first design, or having only json apis on the application server.
The problem I see with the design I'm considering is that I don't see any role of the nodejs server except serving static files. The frontend would get data from the pouchdb database which would sync with the couchdb database backend. I need an offline-first application capable of working locally when there's no connectivity and syncing when connectivity is available, so this is important.
But where do I implement the important bits of application logic that I need in the backend, like form input validation or user access control? I found some ways to embed logic in couchdb databases (like using filters as shown here) but somehow writing application logic in the database doesn't feel right.
What part of the big picture am I missing here?

use existing spring, spring security, JPA backend in mobile application

I have one project (Web) in which I am using
HTML,JSTL,JS .., JAVA, spring MVC, spring security, JPA and mySQL
Everything is working fine in this project.
Now my client is asking to create a mobile application (Android and IOS) for this project.
My question is:
What approach I should choose to use the same back end in my mobile application with minimal changes.
I do not want to write all the stuff again for back end.
Can some one share any example as well. (may be a small demo or so).
Its better you take advantage of web services here. RESTful webservices come with many handy features to address this issue saving us from re-writing the whole code for mobile applications.
We work for an eCommerce client, our mobile apps access the back end through apis which is primarily written in Oracle ATG Commerce. By this approach back end is completely decoupled from front end and this facilitates the view technology (web or mobile) to be independent. Our APIs are hosted on cloud container APIGEE. Soon, we are planning to dump the old jsp views in favor of Mustache templates to support responsive websites(unique view across all the devices).
Refer this page Restful API for Mobility Solutions. It might give you a peripheral idea.

Native Mobile Webapp vs. Mobile Browser App from a ServerSided Point of View

Is there an important difference between native mobile apps and mobile browserbased webapps according to the connection to a server which e.g. calculate stuff and sends it back to the mobile device?
The reason i ask is that there is a wide range of mobile app frameworks for serverside like vert.x, node.js, spring and many more. Isnt it just regardless of which framework I use to build a server for communication with mobile devices, no matter if they use a native app or a browser-based app - assuming they are totally equal in user-interaction?
I know there are differences in "what kind of information" is transacted between server and client according to performance, speed, scalability. My question aims only to the differences of native and browserbased web apps.
I just read this post: Server-side architecture for mobile web applications but i guess its not satisfying my lack of knowledge because author and question-resolver both refered to UI frameworks for mobile web applications. My idea is to have one server technology which is used by a mobile browser web app and the same app as native app at the same time with the same performance results. Is that something to worry about?
greetings
You can do the client side with browser and mobile apps with the one server side stack. Choose the server side depending on your skill set or those of your partners/employees and taking account of the nature of the task including volumes.
I would go for a server side that will support restful communication as that can be used by browser or mobile apps quite easily.

Azure Web Site with Push notifications

I'm trying to develop a Windows Phone 8 app. I've created a Web Site in a Windows Azure account which is an MVC 4 project with REST endpoints. I've got an SQL database in Azure to store data from the Azure Web Site. Ocassionaly, I want my application to send PUSH notifications to mobile phones. So I've created a Mobile Service and I've linked the SQL database with the Mobile Service's database in order to have got the same data for the web page and the service.
I though that when I send an HTTP POST to the web site, the script in the database from the Azure Mobile Service would be launched but it looks not to be true. Isn't it? Because of that, I would write in the controller of an HTTP POST endpoint the code to send the data to the Mobile Service endpoint in order to launch the JavaScript code to send the Push Notification.
Is that the right approach for my goal? Is there any way for sending PUSH notifications from an Azure Web Site or it is only allowed from a Mobile Service?
My last question: Do you know any books or blogs about development in Windows Azure? On the Internet there is lots of documentation but principally those are get started tutorials. I've read some books but those are really complex, boring, and not really practical.
As your website MVC4 based and is running on Windows Azure using SQL Database as backend, I will guess that it is based on ASP.NET and i will write my suggestion based on that.
Now about your question "Is there any way for sending PUSH notifications from a Azure Web Site or it is only allowed from a Mobile Service?" I would say, Azure Mobile web services are designed for the same purpose for any service running on Windows Azure to send push notification on multiple of platforms. Application developer can choose to use Mobile Services to expedite their development as well as have multiple application using the one single service for such objective.
However as you mentioned "Is there any way for sending PUSH notifications from a Azure Web Site" this is not depend on "Azure web sites" instead it is depend on what development technology you are using with your Windows Azure Application. For example in ASP.NET your can use SignalR implementation if your application is based on Java, PHP, Python, Node,js etc then you can find some other run time specific real time implementation. If you look around for websockets you will find implementation in almost every popular language or look for comet programming on this regard. Not only that you can use some of the popular 3rd party applications for this purpose as well. i.e. pusher or any other.
While Windows Azure Mobile Services will give you the best results on Windows Azure platform as it is designed to provide such specific functionality for applications running on it.
Recently released: Azure Notification Hub
http://msdn.microsoft.com/en-us/library/windowsazure/jj927170.aspx

Resources