How to Implement Application server - android

I have to implement a client-server architecture where there are many android client located at different places querying the application server (running all the time (24x7)) and which will do task accordingly and reply to clients. But I don't know what exactly application server is and how to implement it and what is easiest and quickest way to implement this. I am running out of time that is why posting this question otherwise I would have gone through lot of tutorials instead.
The server code is to be written in php/c#/java.
Any quick help is highly appreciated.

You may have look at Google App Engine its easy to setup, hosted on google environment. Which might fulfill your need. In this case you don't need to buy hosting plans etc. etc. You will get yourappname.appspot.com URL to use app server.
Hope it helps!
Note:
Appengine supports Python and Java

You can implement it by knowing how the application servers work.
First of all, you should create a class that implements the HttpHandler, in handle method you can get header and body of the message.
Secondly, you should choose how to handle the request in HttpHandler. One possible approach can be using of ThreadPoolTaskExecutor or SimpleAsyncTaskExecutor or any task executors.
Finally, you should prepare the response messsage with exchange.getResponseHeaders() and exchange.getResponseBody()

Related

Android : what kind of server?

I'm developing an android app where I would like to fetch some data (mostly text) from the internet but not necesseraly from a website! I would like to have a server that allows clients to fetch some text data. What kind of server fits my goals the best? Http or maybe simply tcp? I don't know much about http so I don't know if it matches my goals and/or if it handles well a kind of text "database".
Edit:
A use case could be: people could write comments and send them to the server. Then clients could refresh their app by fetching new comments from the server. Therefore I'M asking what kind of server could best handle services and kind offre database if needed.
I like using NodeJS in combination with ExpressJS for such purposes. This combination allows you to easily work with HTTP/HTTTPS which is allowed by practically every firewall or proxy server. As of the latter reason I recommend you to use HTTP instead of an own protocol. Furhtermore, Java offers the HTTPURLConnection client which is very easy to use. Moreover, securing traffic with TLS (SSL) is very simple. In addition, NodeJS is resource efficient, runs on Windows, Linux and even on OS X.
For getting the text you can use HTTP GET request handled by the get() method of the Express instance.
This compact tutorial helped me to get familiar with Express on NodeJS.
Without knowing what your use-case is it's difficult to make a good recommendation.
With that said you may find something like https://parse.com/ suitable.
They provide an Android sdk and the 'getting started' tutorials will have you up and running in no time at all.

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.

Use POST function from Android, using Drupal as back end

as the title said,
I'm looking for a method to handle a POST request made from my Android front end to my Drupal back end.
I've already seen a lot of documentation and reference, like this one: http://tylerfrankenstein.com/code/build-mobile-app-sell-products-with-drupal
but I can't figure it out.
Anyone can help me?
Use Services
It sounds like you need to setup an API using something like a REST service. Drupal has a great module for this called Services.
Essentially you can setup your Android app to use the POST method to push to your Drupal configured endpoint.
EG: https://www.mysite.com/api/android/
Services is extremely flexible and you can have it work through basic CRUD operations for nodes or you can use hooks and use custom logic for a particular service you want to use and write custom PHP code to do whatever you want.
How about using this library for native Android applications to communicate with Drupal web servers?
Feature list:
Synchronous and asynchronous requests
Flexible object serialization / deserialization
API can calculate object differences to perform patch requests
Simple entities request

App Reading From SQL Server Web Service

I am in the process of creating an Android application which I want to use to execute a web service on my SQL server which in turn runs a stored procedure.
Having never completed a project like this before, I would like to know what the best way to go about this is?
I.e.
Displaying the SQL results
Reading from the web service
Adding password protection
I've developed apps before, but never SQL - related.
From doing some research I noted the need for a web service and created one, it's the process of running my app to read from it which I would like guidance with. Even a link to a helpful tutorial would be great. Thanks.
EDIT
To be more specific on the display.
Currently the stored procedure is displayed through crystal reports, however I have no need for 'drill - downs' or any functionality other than to actually view.
Something similar without the functionality would be fine.
I would recommend KSOAP with a SOAP webservice for proof of concept/tech demo http://seesharpgears.blogspot.com/2010/11/basic-ksoap-android-tutorial.html
or use the built-in JSON parser with a restful/json webservice
How to call a json webservice through android
Perhaps this link can help you, it has a useful video on the subject and detailed information.
Another link Comsuming WCF Services With Android
And also maybe this could help: Android Web Service MyWeather

Is an Android Service a good idea when backing up an app's data using a web service?

I'd like to add the ability for my android app to save changes to data (stored in its SQLite database) to a web server. The upload will be via HTTP POST, using JSON in the body of the request to describe the changes.
I'm wondering if I should use an android Service for this. I'd like the user to be able to continue interacting with the app while it's generating the JSON, making the call to the server, and waiting for the server to complete its work and return a response.
Thanks much!
Even better would be an IntentService
Edit: Now that the compatibility package is out I think the new Loader class may be the best option, possibly using the ASyncTask version or a variation of it.
Yes it is a very good idea to move all the webservice code into a service. The Google IO talk Developing Android REST client applications talks about many reasons why this is a good idea. It also covers other important considerations which relate to your problem which is effectively syncing your database to the cloud.

Categories

Resources