How to send data from android to java application on server - java

Hi I want to send data from my android app to server and store in the Mysql database. But I want to use REST method to send the data and I want to create a Java app on the server side that will show the data in table format .
I have created the android app but don't know how to upload data using REST. The data which I want to send is latitude and longitude of current location.
And after refreshing the java page new data will be viewed on the page.
Please tell me how to do this task.
Thanks in advance.

You can use some framework to communicate with a server. I think retrofit is the best choice for REST API: http://square.github.io/retrofit/
But you can try the Volley. Or the HttpUrlConnection and DefaultHttpClient in android sdk.

This is a big question that would need more space than here to cover. To get started you could try looking at the spring boot or drop wizard frameworks for creating your REST service.
Coursera also has a course programming web services that might help you get started.
Alternatively, there are services like Parse that look after the backend process for you.

Related

How to send a notification to a AngularJS app from a Java app

I have a weird problem. I have an angular app which should display data from a Java Rest API. My java rest API doesn't have all the time data because this data comes from others systems.
So I need somehow to notify Angular app if I have available data in my API and to make a request to a specific resource.
Something link this:
Other Systems sends data -----------> Java API receives data
Java API ---------------------------> Notify Angular about new data available(e.g POST x.x.x.x:4200/notifications)
Angular makes a request to ---------> Java API for the new resources (e.g GET x.x.x.x/api/newData)
I don't know how I can notify an angular app about this new data because in order to do this Angular should behave like a server.
If anyone has some ideas regarding this problem and maybe other suggestions it will help me very much.
Thank you.

AutoCompleteText with API Result android

I have An AutoCompleteText in my android application that's take it's list from web services and my records in database going to be a big data like more than 100 thousands, and I can't do pagination because it's not going to give me correct suggestions, and i can't make a listener to do filter in web serves because it going to send too many request in less than second , what is the best way to do it , I am using laravel in server side and java for android and volley for API http request

integration of Android with servlet or mysql database

I have made school management software...for the server side I have designed the admin panel using servlet and jsp technology.and have used mysql database and for the client I have created an Android app. I want to perform login and logout authentication and fetch data of that particular user on his app.. but I m unable to integrate. I need to know what are ways through which this thing is done professionally....
Thanks in advance
At your backend side you have your servlet which handles incoming requests GET or POST. So in android app you just need to make call to your servlet and handle the response.
In android
1. Get the user credentials and pass it along with your request.Either make GET request and append your credentials to servlet url or pass the parameters as POST request.2. To make network calls use libraries such as Volley, Retrofit or you can even use android built-in AsyncTask.(If you are a beginner start with AsyncTask first and then upgrade to libraries mentioned).
Professional way is to develop REST apis at your backend and call them from your android app.

IOS Application Fetch data fro MySql Database

I'm practicing some IOS coding in Swift 2 which consists in an app fetching information from a MySQL database.
However, I'm confused in the concept. So currently my idea of how to accomplish this is that somehow the IOS App connects to the Apache Tomcat. To be able to do this, I though about creating a Java application that connects to the MySql using JNDI. With this I fetch the data and store it in a JSON object.
However this is where I get stuck. Should I return this object to the IOS application or store it in a text file or JSON file and have the IOS application read it from there?
If I had to return the object, how can I do this? I've looked around but most examples are fetching information from an API and currently I want to do it locally.
The easiest way is to create a PHP file to connect and retrieve data from MySQL, and then you call this file by swift.
You will find a useful information in the following link :
How to make an HTTP request in Swift?

how to retrieve data from phpmyadmin and display in android application

i had used eclipse to develop an android apps that can allow user to register.
after they register successfully and go into the main page, they are able to see their own profile which consists of the details they keyed in during register. (The details will saved into phpmyadmin)
any method can retrieve those details from the database and display it on the profile page? (i am using php and java)
thanks for answering..
You can always use "Zend AmF" or "AMF PHP" for comunicating with the app, binary.
http://www.silexlabs.org/amfphp/
http://framework.zend.com/manual/1.12/en/zend.amf.html
or amf mixed with codeigniter
https://github.com/EllisLab/CodeIgniter
Then use:
- http://code.google.com/p/klio-mobile-dataservice/
to connect with your server
You need to have a server, like a Tomcat, or anyother server, to which you will post the data
The Servlet or the PHP script, will read the values, store them in database.
The Android application will get the data from another Servlet or a PHP page, using a HTTP Get request, and show it on the screen.
You can alternatively, store the keys locally in the device, using SharedPreferences, and get them in the next screen.
You have to write a php script wich parses data from your database into for example JSON-Format. If you had parsed the json you can use the JSON parser in android to show he content in your activitys.
Here is a very nice tutorial for json parsing in android:
http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
Basically you have to create Web Service in PHP or Java and from there you need to get your data.
You have to create Restful API which returns data in the form of XML or JSON and you need to parse those data at android end. By this way you can get your data from PHP.
Here is the best resource which i found when i was searching for this kind of scenario. The author has explained very well in this and you will get very good idea about the scenario. Also provide sample code for reference.
Refer this link.
Hope this helps!

Categories

Resources