web service to alter from endpoints on android - android

im wondering the easiest way to go about this. I've used retrofit for java before to post and get from endpoints in web service my friend wrote in python.. However I've never wrote server side stuff. I have phpmyadmin running on a vitural server... Havnt used it yet however. I just need people to be able to like or dislike a poem they get from the server. Is there anything on the web I could set up like database I can alter from its endpoint? Or am I going to have to learn php and python now? Thanks guys!

To develop a web service is not necessary use php or python. If you are used to programming in Java I recommend you to use Jersey (https://jersey.java.net/) which offers an easy way to define your endpoints. You can also use jackson (http://jackson.codehaus.org/) to process the json info between client and server. Jackson helps you to transform a collection of object form JSON and vice versa.

Related

How does android retrieve data from a website?

I'm new to android, I'm trying to build an android app that is a front for a web portal. For example, Airbnb. They have a website, but they also have an android app that, using it's own layout, will show listings from their website.
There are many websites that teach how to or even directly convert your website to android apps. However, this will result in an app that loads too slowly and is unresponsive due to CPU usage.
Could anyone share any tutorial/guide to learn how to do this myself?
Million thanks.
To actually load data from a web server you're gonna need and API which usually delivers the proper date using JSON or XML format so that you can properly parse and display that data. Building this API is in it self a complete course on its own.
But connecting to and requesting data from the API is usually done using some networking libraries. These are some of the better know libraries for this purpose.
OkHttp: A complete library with a set of tools for handling network connections and HTTP requests.
RetroFit:Type-safe HTTP client for Android and Java by Square, Inc. which is built on top of OkHttp.
Async-Http-Client:
The Async Http Client library's purpose is to allow Java applications
to easily execute HTTP requests and asynchronously process the HTTP
responses. The library also supports the WebSocket Protocol. The Async
HTTP Client library is simple to use.
There tons of other good libraries.
its called webservices
Through android you get data in form of json from a web server and then return in custom view as you want.
Follow this link hope it will help
Step by Step Method to Access Webservice from Android
you would have to write an API/Web service or use if already exits to fetch data from web server. Basically the concept is that, the website itself must be pulling data from some database, so write an API which would fetch the data from same API and return JSON data and consume the API from your android app.
If you know PHP refere to this for the help :http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
You can write WebService, in programming it generally refers to a web page(ex. Airbnb), that can be called from your android application which can pass in data to it, or receive data from it.
WebService is basically like a 'method' or 'function' in a normal programming language; except you're calling it over the internet.
The first thing is you have to create a Web Service. The Web Service will be your "bridge" to consume the data from other Website like airbnb or others and return the data to your android through json format for example.
You can create a Web Service using many languages like C#, Java, PHP, etc. I would like to recommend you to use the language that you know the most.
You can try to google this
Cheers

Accessing data from Local MySQL Server from Ubuntu in Android

I want to install MySQL on my Server and create a database and access my database through my Android Code. I know that this work can be done through webservice in Android, is there any way that I can use it without webservice. I don't find anything related to this. Please provide any links useful for this kind of work.
Yes you can write one restful web-service which will interact with your MySql database, and then you can integrate the service with your android code.
To connect your java code to MySql, you can simply use JDBC or hibernate.
To integrate and consume the restful web service, you can use spring-android-rest-template(to call web service) and jackson-databind(to get responce in JSON format)jars. You should read once this link. I have also used the same for my android app, and It is working.
Its really easy to learn and use.
It will take hardly 30 min. to understand it.
https://spring.io/guides/gs/consuming-rest-android/

Socket.io and node.js example in android

I am new to socket programming i have to use socket.io and node.js to connect with my server host in android so can anyone please just describe me the programming example of how to connect to server in android. And if possible please give some help regarding node.js and socket.io. As i have searched everywhere on google but not able to find out the proper example.
Thanks
You can just have your web service be REST base.
Your Android application can just talk to your web server via REST and receive data json or xml whatever you fancy.
So with node.js you should set up routes.
An example would of a route would be
www.example.com/users via GET post would return a list of users either in JSON/XML
For your android application you need a library, I believe there's a built in one already, to make request for certain routes such as www.example.com/users via GET method and write the logic to expect JSON or XML and parse that.
I just googled this:
Android: https://github.com/koush/ion
As for node.js you just have to build route...
I think is would be better:
websocket api to replace rest api?
It actually invalidate my answers sorry, REST and websocket api are different.
I have no clue what problem exactly you have. But you should break your problems down to small part. And google and search for answer for each smaller part which would make your life easier to google.
Get your webservice up first so that your android software can consume stuff, build a prototype and then build a prototype of android app that consume data from that webservice.

Creating Web Service for Android Application

I've been reading some info about Web Services for Android using SOAP or REST but I've never created a web service so I have many questions about this.
I'm developing an Android App where the users answer some questions and for each user an XML file is generated and saved in the device.
Here are my queries:
What I would like to do is to send these XML files from the devices to the Web Service and also sometimes to retrieve all the files to any
device.
Do I need to convert these files into Byte or just send the XML?
Are these actions possible with the Web Service or will you use Java Sockets? In case you prefer the Web Service, what would you use:
REST, SOAP.
I would appreciate some links to tutorials and piece of advise.
Use SQL Server to manage the data on your desktop and create a web-service in .NET on Visual Studio.
Then connect to the web-service in your application and set/get data from the DB, using web-services. You can use either XML or JSON to transfer your data between the phone and the server.
There is no need for the use of Java Socket API for this.
Links which might be useful :
How to make a web-service in .NET (does not include the implementation in Android) : http://srikanthtechnologies.com/blog/dotnet/wsdaljava.aspx
How to connect your service with Android :
http://seesharpgears.blogspot.in/2010/11/basic-ksoap-android-tutorial.html
http://www.codeproject.com/Articles/304302/Calling-Asp-Net-Webservice-ASMX-From-an-Android-Ap
http://adrianandroid.blogspot.in/2012/05/access-c-net-web-service-in.html
Note: I have never worked on RESTful services. My work has always been on SOAP and hence it remains my preference.
Your final choice of how, exactly, to architect your app, is going to be based on all sorts of things that you haven't included in your questions: your experience, the experience of the other developers in the project, so on and so on.
I will say this, however. REST is deep in the heart of Android. If you decide to go with REST and, possibly, JSON instead of XML (there is, almost certainly, no reason to use byte arrays), you will find that Android's architecture supports you. SOAP and such and you are on your own.

I want to implement a RESTful webservice do i need something om my server running to handle requests , like with SOAP

I want to implement a RESTful webservice for an Android App using JSON. Do i need something om my server running to make for example a GET request work , like with SOAP is the case. I have read something on servlets but i don't know if this is neccesary or not.
If you will be using PHP on the server then you can write a RESTful service with a PHP application framework like Kohana, CodeIgniter, CakePHP etc. There are quite a few.
These frameworks have built in functions for encoding results in JSON format and they support the REST approach out of the box.
If you prefer I'm sure there are also similar IIS and .NET based approaches too.
If you query your own server, then you need to first program your server to handle requests. On the other hand, if you query a 3rd party RESTful server, then all you need is create the appropriate http request, send it and handle the response.
Servlets are used for Java EE based implementations of servers. You can implement your server in any programming language or framework you want.

Categories

Resources