Web service platform for communicating with android app - android

I want to create a very simple rest-like web service to be used by an android application. The web service just needs to offer a way to add user entries to a simple database and retrieve other users' entries.
What would you recommend as a platform to accomplish this?
I was thinking google app engine might be a good way to get this going without worrying about hosting but asp.net mvc or django are other possibilities.

I know this isn't a direct answer but I would shy away from any sort of offical XML-based web services. I've found that JSON is far less verbose and generally leads to faster response times as opposed to full blown SOAP messages. I would urge you to evaluate JSON as your "transport" mechanism.

Related

Can I use Ruby on Rails as a native Android backend?

I have a web application developed with RoR, and I was wondering if it was plausible to use it as the backend for an Android application that I would develop in Java or Kotlin?
For example, if the web applications authentication is handled with devise, can I get the Android application to send the name and password to my web application and have it return the user as a JSON?
Absolutely you can.
Usually the Android app would call an API rather than a web page. That is you don't exchange HTML like a browser does, just the essential JSON. Lots of things work the same as a web site. For example you can use the same authentication mechanism for the API as for the web-site.
This is a good starting point for RoR to create an API.
https://guides.rubyonrails.org/api_app.html
Here's a starter for Android making a web-service call:
https://developer.android.com/training/volley/simple
That's just a get, which you might use to get a list of something that's publicly available. It's probably worth understanding the other pages just there because with web calls it's really easy to do bad things like lock up the UI thread, so best to use the example patterns and methods.

Best way to expose services from .net to be used by mobile apps

I'm going to create an app for iOS, Android and Windows Phone that will expose the same features that is currently available from our website which is currently being re-developed, and one of the main feature is a search feature. The website along with all the layers are all built with .net (4.5.2) and sql server and we need to expose all the services to be consumed by the mobile apps. The good thing is that it's up to me to decide how they should be exposed, but I'm not sure what's the best technology/protocol to use. What I've been told it should meet is performance/responsiveness. I thought about exposing the services as a WebAPI layer but I'm not sure if it's the best way to achieve such a requirement.
What would you recommend? Does anybody have bone through a situation like this?
Adding an api layer to an existing web application is pretty easy and I think is perfect for your needs. That way you can essentially wrap your existing functionality with the api.
See this link
Since you are redeveloping the server side, I would take a close look at Azure Mobile Services. If that doesn't work for you, and you need something more custom developed, I would still consider Azure hosting with a Web API layer - Web API is definitely the way to go here as it provides easy way to exchange mobile-friendly JSON with a thin layer over your services.
By the way, for any new .NET development, I would go with ASP.NET vNEXT
Since you are targeting multiple clients, you should expose your business as restful services that return data as JSON and also I would recommend using OData (Open Data Protocol) which is an OASIS standard that defines the best practice for building and consuming RESTFul API.
Also OData provide useful querying techniques for example the following URL will return first 2 persons in the system who have registered at least one trip that costs more than 3000, and only display their first name and last name
http://services.odata.org/v4/TripPinServiceRW/People?$top=2&$select=FirstName,LastName&$filter=Trips/any(d:d/Budget gt 3000)
For more information about OData please check http://www.odata.org/

How to feed data to a mobile app for a website

There are various websites (say LinkedIn) which have a corresponding mobile app.My question is - "How they feed data to their mobile apps?". Obviously they are not doing HTML scraping of their webpages, otherwise it would be really inefficient.
I am asking this because I have a website, and I am also going to develop an android app for that.So, do I have to design my website (like database) in a specific way to support mobile apps. (I mean, what are the preconditions do I take care of , while designing my website, in relation to the mobile apps)
What you need is a web service. It sounds little complicated but actually its not! in normal websites when you visit a website you get HTML data. but in web service when you request for a data you get the data in xml or json. Then on client side you parse this data and show it as you like.
The most used method for sending data between web services and clients is called RESTful web service and it usually uses json. So after a request you get a .json file. I highly recommend you to use RESTful web service especially since you are a beginner.
As i said RESTful web services are famous so most frameworks support that! So if you are creating you website with this frameworks you don't have to code anything! they build the web service for you. If not there are plenty of code for any given language.
Another thing is since xml (and json) file are platform independent you only need one web service to handle all of the client (android, ios, windows, etc.). And there are sufficient tools and libraries in each platform to work with xml (json) files. Sending data to server is also the same, you send the data in xml format, service receive it and do what ever need to be done (for example stores the data in database)
Lastly the world of web services are a lot bigger. What i said was a highly simplified version to give you a whole idea! If you interested to learn more there are plenty of books you can read. Many people (including myself) think web services are the future of internet. Where different services each developed by different company work together to provide user with something great.

Web services for mobile necessity

I have a website and i need to make an app on android and iphone and the app has to communicate with the server,similar to facebook app.Do i need web services like SOAP for this.I read their documentation but how necessary are they and what is their main purpose? Can I do the same without using web services? my website is in codeigniter
If you need to implement web services for your app, I recommend taking a look at CodeIgniter Rest Server. This provides an easy way to implement REST web services, which are lighter weight, easier to work with, and more flexibile than SOAP.
Benefits of using a Web Service:
1 - Usability: You can develop Android and iOS apps, and both of them can use the same Web Service. Other smart phone platforms can also be developed later and use the same Web Service.
2 - Flexibility: For instance, you need to have a mechanism to talk with the database. You can implement the database transaction in your Web Service. (I have experience in using hibernate) You do not have to create a database configuration in every smart phone app. If you decide to change your database, then you just need to modify your database configuration in the Web Service - nothing changes on the client sides.
3 - Security: It is not a good mechanism to connect directly from a Mobile app to your database server. You need to have some kind of Authentication mechanism that can be provided by a Web Service.
Which kind of Web Service is better? I agree with #Justin that REST is a good approach since it is lighter, simpler to implement and more flexible.
SOAP can be a better approach when Security is the most important thing, for instance in certain enterprise scenarios. REST vs. SOAP
Are webservices necessary? Well the correct answer to your question is it depends on the app. Most apps that connect to a server to get some information use web services. However, no you don't need to write your own web services. Increasingly people are using platforms like agigee
http://apigee.com/about/products/usergrid/
So no you would not need to write your own api if you used usergrid, but you might want to if you wanted to keep the data all within your own infrastructure.

What should I use as a server to meet the following requirements?

I am trying to develop a system that involves a:
server with a database that will handle the system's logic and manipulate data
an android app that will interact with that server (pull and push data into the server)
a website that will do the same as the android app, but from a website with slightly different data.
What I thought of is to use SQLite with Apache Tomcat installed on the server and deploy a Grails war file on it. That will take care of the 'website' side of the system. But what about the android app? Can it communicate with Tomcat as well?
Tomcat will suit your needs. I would look at hosting options though. Are you hosting your own server, or do you have a hosting provider? Do you have experience hosting a tomcat server etc. Do you have experience with java web applications, or other web frameworks? All of the above, and probably more should lead you to your decision on what type of framework/language to use on the server. This in turn will lead you to your options for hosting, and web-container to use.
Once that is determined all major web frameworks will allow you to publish web-services Rest, Soap, etc. that can be consumed by an android application.
Also, if you are planning on providing a web interface and service at the server level, my guess is you are going to be storing a fair amount of data, I would look into a more robust and scalable database such as mysql or postgres. This post contains some insights into this.
If you have an API that is web accessible, an Android can access it.
Android shouldn't have any problems communicating with Tomcat.
Look at http://grails.org/doc/latest/guide/13.%20Web%20Services.html for more information.
A RESTful web service is most likely what you'll need. Android can consume SOAP web services but it requires more work for less overall functionality.

Categories

Resources