I want to read and update data from server (using Apache) to my Android App.
I`m new at the Apache part.can anyone give me a guide for this kind of operation? I already download "XAMPP", and my main goal is to read a JSON into my App, but I believe I can manage also with php .
I know that this is general question but I don't understand at this subject.
Thanks.
the most basic way is to make sure your web server is listening on an open port(usually 80). in your android app send a request to your webserver (url request). on your server hava a script that echos or prints JSON data...
Apache is a web server. You need to connect to it using HTTP. There is an HttpClient and other ways to get http server data, as long as you have a network connection.
Related
I´m programming an Android App that recives Data from an other device (not jet final what device some kind of Wifi board) via HTTP Json-File but i dont know how to "pull" the file and parse it. I´m new to Kotlin so thanks for your help :)
It sounds like your not just new to android. You will need a webhost server set up. The easiest way would set it up so that when the url is connect to it echos your json response. When your app executes its http get request you parse the resonse.
I highly recommend Fuel for kotlin. It just works.
Kittinunf/fuel
I want to send image and text data from Android phone to a Server. i am new plz suggest me the best and easy way to do this task. Server is running a java web service and i will be getting the data from server and also sending the data to server. Thanks
As your server is already there, you will have to use protocol it can uderstand - also SOAP, REST or whatever it uses. So no choice for you.
If you are deigning client-server interacton with android application, you may consider network socket communuication which has less overhead as webservices.
I am developing an android app where a user has to enter his login details for authentication...the app will then check username and password entered by user on server and will act accordingly..so how to pass these login details to server..and do I need to implement web service on server side or can use servlet?
Can anyone please tell me which Web Service should I use for the above purpose...also I need to send other data from my client app to server, process it on server and give back the reply to client app...also how to implement a web service? Are there any tools for it? Any tutorials would be of great help.
Thanks in advance...
well, to send data to the server you can use HttpPost and HttpGet requests.
and as you need to get results from the server then, yes you'll need a web service.
You can use servlet (or) webservice, any service, as long as it can be accessed through URL. Make sure the servlet/webservice returning XML/JSON (one of these two formats are preferred, you need to code your servlet/service to return response in one of these formats) response when you hit the URL in internet explore. Once you make sure URL is returning data, then
1) In your app, using HTTPClient, invoke the URL
2) You will get either XML/JSON
3) If it JSON, use in buit JSONObject to parse the response and get the data
If response is XML, use either SAX/Dom parsing to parse the response.
i need to develop an application for device management i am beginner in android and java. i want the client to send request for patch to the server and the server sends the requested and i also want to use web service to it. i wish to know how to lay connection between the individual android clients and the server. pls do send me some sample coding or tutorial???
i do not prefer doing it with php server Android PHP server
Since you don't want PHP and you specifically say you are using Android and Java, why not implement a servlet to host the patches. Then use HttpClient on the android side to send a request over to the servlet and have it respond with the patch.
More on servlets:
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
And some simple code for HttpClient:
http://w3mentor.com/learn/java/android-development/android-http-services/example-of-http-get-request-using-httpclient-in-android/
I have an app in android,a kind of client-server in which the client has stored some gps data in Sqlite database and once connected with server it delivers it that data which at its turn stores it in it's own database for future manipulation!
Now the problem is that I have to create a server that accepts multiple clients and I cannot find a decent example in this way.I'm not using no services in combination with it!
Both my client and server are on android!!!!
I have already did the connection between client and server,but only with one thread(I mean my server can accept only one client at this moment!)
Is this suitable?
How to implement simple threading with a fixed number of worker threads
Thank u in advance!
If server is Microsoft based, .net web service can be used that can be accessible from multiple Android clients and work with database.
Your server is not on the Android device I guess, so I don't think the question is android related.
Check out this example of multithreaded server in Java and this one as well.
To communicate with database, see the Java JDBC tutorial.
Those examples are in Java, because that's what I am used to, but any other language will fit as well.
A simple POST request from the client to the server should be good enough. Encode the data in a suitable format (JSON/XML) and send it as a POST HTTP request.
I don't understand why you want to write your own server. I would just use a PHP/Python script running with Apache to receive the POST request and store the data in a database (MySQL, PostGre).
On your Android device, you should put all your code in an AsyncTask. Android uses the standard Apache libraries to make the HTTP request.