Angularjs/Ionic SyncAdapter equivalent - angularjs

Based on this question Sync data between Android App and webserver, I would like to know if there is an existing javascript (not native) SyncAdapter for an Ionic app (just angular is also ok). If not I would like to get some guidelines to write one in the following aspects:
How to maintain coherence between app data and server data
How to manage app offline situation
Recommended interval to refresh from server
Battery saving management

Related

Which language for web app with complex UI?

Context
Our project has a Java back-end that accesses a Neo4j database. The back-end is nearly finished. Previously we intended to build a Java desktop client with a JavaFX UI. Now we are considering building a web application instead. I will be building the front-end. My previous experience was mostly using Java. I will have to learn a new language. The thing I'm having some trouble with is determining which one is best suited for this project. Before we begin front-end development we also want to ensure that the web app will be able to handle all features we had planned for the desktop client.
Requirements
Connection
Send HTTPS requests (not expecting any problems here)
Keep a persistent HTTPS connection open to receive server-sent events
Data
Store and handle considerable amounts of information received through server-sent events (potentially millions of events)
UI
Create a beautiful and highly reactive UI
Create complex custom components
Drag and drop support (also not expecting any problems here)
Integrate a view of an external site into the UI
Platform
Platform independence
No need for browser plugins
Candidates
These are some candidates I have identified during my research:
JavaScript with React
ASP.NET
Python with Flask
React js for the front end. Most anything for the backend. We use Python/Flask for routing and inserting into templates. But, you will really appreciate React for its "reactive" UI. It's incredible what it can do. I see no problems with the task list you've given.

How to make Ionic app work with an API written in Laravel but still works offline

I would like to ask how to create an ionic app that talks to Laravel API but still works offline when there's no connection.
Let's say i have to write a quiz mobile app in Ionic and it requests for Laravel API to retrieve the questions as well as store the scores in db.
I'm just starting to learn Ionic and i'm really confused right now on how to approach this.
What confuses me most are:
Does the Ionic source live inside the Laravel source code w/c serves the API?
If i want the Ionic app to be installable, should the Laravel source code be included as well during the compilation process?
Thanks in advance for any help.
Your php or in general server side code is completely independent from your ionic application. If you want your app to work offline you should think about something like fetching a high number of information initially and work with this data without making any additional requests.
However your ionic app does only contain the frontend. You could implement some logic for local storage, but if you want to keep information hidden from the user (e.g. solutions) you have to put that logic on a dedicated server.
In the few details you provided, I can say the Laravel code does not live inside the ionic app. The ionic app is separate from the backend API by Laravel. You are possibly trying for a ReST based architecture where you communicate with your Laravel Server with an API. You need to keep those codes separate.
However without any internet, you won't be able to access those APIs, so you will just be able to show some static data, or you could serve from a DB and show later. For how to use the sqlite db you can look here
In your backend you can have an API like
http://example.com/api/v1/questions/1/
Which will fetch a question with options and if you want the app to have the answer for offline storage you may have that as well. When a user answers, you may check whether you have internet access and send answer and verify if you do, else you may save the answer in your DB and sync when you do have access. You can fetch multiple questions so that a user may answer multiple questions in case he/she will not have internet access.
Hope it helps. :)

Accessing data from couchdb using angularJS as frontend and nodeJS as backend

I am new to web development. I want to develop a web application using angularJS, nodeJS, Express and couchdb. The registered user will be given some tasks. So the app must maintain data of tasks assigned to a user and tasks completed by the user. It should also maintain the data of users when they register for this app.
**I am able to access data(user name,tasks assigned to user,tasks completed by user) from couchdb through nodejs. But I don't know how to make angularjs access the data accessed by nodeJS and display it on web page. I would like to know how to access that data and display it on webpage.**You can take tasks as repairing a chair or something.

how to get data from moble app into web app

I have designed my web app using mvc and designed the web api's to send the data to the mobile app in the form of json. I want to understand what to do, if a user registered on the mobile app,I (as the server side) should be able to get this data and save it into my database (again server side) so that the user can access from web app as well with the same credentials.how could that happen? I mean should I design a web api to receive data from the mobile party?I hope my question is not dump or silly or asked wrong because I'm trying to learn and understand. I really would like some explanation.

Cross-Platform Mobile Application Solution

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.

Resources