i'm trying to connect android app to django web server that both android device and django web server are using a same internet connection(both connected to same AP) and sending data that in my case it's Json file.
django web server should take the Json file and change the data stored in database(in my case MySQL and django runs on python3).
is there any way to Not use rest API?or using something like Socket programming in django?
remember i just want to send Json file in WLAN network.
Thanks you.
You can use Sockets, but i think HTTP request are much more simple to work with, as django is WSGI based, and it doesn't support Sockets out of the box, you will need to use something like Channels to handle sockets.
Related
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.
can someone please help, I need to develop a android app that will then be converted to IOS using Xamarin however how or what it the best way to connect to a SQL sever database that is hosted? I will have a connection string
I don't know whether direct connection from android to SQL server is possible but I used to connect via a WebServer Eg. Apache Tomcat by deploying any WebApplication that have access to database server.
The thing how it works is, we will pass parameters from android through NameValuePairs/Json types and these parameters are parsed by server application (Processing business logic) and gives back the response in String/Json format.
I am trying to learn to implement android apps to get news, promotion message, and calendar from server. What is the best and easy way to communicate with database server? using JDBC or other methods?
Thanks
Using JDBC?:
In the words of Commonsware:
Never never never use a database driver across an Internet connection,
for any database, for any platform, for any client, anywhere. That
goes double for mobile. Database drivers are designed for LAN
operations and are not designed for flaky/intermittent connections or
high latency.
On the client side (Android app), you can use SQLite to store data locally. It might not be necessary at all actually. For instance, it can be used for offline features, search, etc. For client-side, read up on this simple post
On the server side (whatever server side technology you know or want to learn), you can use whatever language, whatever database on whatever server OS you want. This part is commonly called the back-end, which will store your data while your app communicate with it through HTTP.
You can use json to parse data between server and the android device. In the server you can use jdbc with json if you are using servlets in the server.
To communicate between a server and an android device you can use JASON. See following links for some help.
http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
https://www.learn2crack.com/2013/10/android-asynctask-json-parsing-example.html
https://www.learn2crack.com/2013/10/android-json-parsing-url-example.html
Also in the device to deal with data within the device you can use SQLite. And in the server you can use jdbc if you are using servelets.
To communicate with Database server You should use web service API such REST , soap
I created a small app and with this app I want to send the data (over wifi or bluetooth) to a PC/server.
I am thinking of creating a webservice that will run on the PC and will be listening constantly to any incoming client requests.
Once it receives request from client, the data transfer takes place.And after the webservice receives the data it should automatically open an application/GUI window showing the data received.
My question is Can I create a webservice using TCP/IP in JAVA and have it constantly run in background and listening to client request?
Also how do I start a GUI as soon as the webservice detects a client request and receives the data?
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.
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
the best way is to create a web service and connect your application to the web service, you can use the tool http://www.wsdl2code.com that create all the needed code for connecting and parsing the data :)
I recommend to use WS on the server-side and you can use Ksoap android library on the client-side. Create a background thread which updates the UI with the new data with. Use AsyncTask, Loader or Handler which is fit for your solution. (Read the official reference for more info).
you can easily achieve this by creating an end-points/routes using node.js or php then host it on the cloud. I think I like firebase for hosting for now, u might wonna try that it really cool. after creating those endpoint which will be connected to ur database then u use http get or post request depending on what u want from ur database in ur mobile app.
if u are creating for android use Retrofit for http connection.
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/