My project is create application on android. It can get a location(latitude,longitude) via GPS.After that I want to send a location to a server or web server to collect for calculate a distance which are draw on my own map(may be make from Flash) on a website.
I knows an android have apache, but I don't really know in detail about server, web server, apache.So, I want to know how to send a location from my application to server.
Anyone can help me or suggest me?
Appreciate,
Daisy
PS. I'm a newbie.
If you're writing both the Android part of the application and the server part, then you can decide how to transmit the data. You could go with some simple JSON like:
{"lat":12.34,"lng":56.78}
No reason to come up with anything more complicated than that if you don't have to.
I don't think its necessary to have apache server on server side,
AFAIK> android can ping to any web service on any web server. I can ping an asp web service that can be hosted on IIS.< AFAIK
You can ask the developer of that site to develop web service (api url) that can accept latitude and longitude as parameter (or search the api if they have one (a la google maps case)) and you only have to care about calling that web service.
Related
I want to connect my Android App to the back-end. The aim of the project is to filter spam messages. So the app receives SMSs and then should forward it to server for spam filtering which uses machine learning. Now, the thing is we have a python program for machine learning but I don't know how to connect these two things - the Android app and the python program. Need guidance on how the app can send data(sms) and receive response(whether spam of not) to and from the server-side.
A common approach is to connect your client with a web backend that offers a web API (might be a REST API).
Here is a short overview over this topic: https://www.webiotic.com/api-for-mobile-apps/
What you need is a web server which can receive web calls and send back information. A web server in this sense is just a program which listens to incoming HTTP calls.
In your case, this might look like this:
The server is programmed to listen to web calls with the HTTP method POST on the route /checkMessage
It expects the message data in a certain format
For example in JSON with this content: {"message":"Your actual SMS message"}
the server checks its database or triggers a ML job
server returns a result in a specified format. For example this JSON: {"isSpam":true}
Your app then needs to send a POST call to https://www.[YOUR_URL]/checkMessage with the specified data and wait for a response
There are libraries for android which help you with that like Retrofit or OKHttp
As for which technology to use: It's up to you. You can create a web backend in pretty much every language. In your case, you should check out which Python libraries are available to listen to HTTP connections.
Keep in mind that if your app can publicly access your backend, then everybody else can as well. You will want to add some kind of authentication as well.
I am new to android, and i m working on an app dat needs some server side code.For that i m thinking to use J2ee, now tell me(the concept n requirement only) so that i can send the data like log in form details to server from sqlite of android, and after some processing i want to send notifications to client devices.( i know for that i have to use google C2Dm).
But the actual problem is how do i test these things on my pc,before publishing the app.
also tell me the tools dat i need to install beside android sdk , and the language that i need to learn that can synchronize or simply send android data to server.
I have seen that when we register in websites they send us message for conformation. which technology is used here.
and last after my app is ready how to publish it, the whole process(including where i will be putting my server database and server code).
Hi I would like to suggest you to implementing a REST based web service in Java EE server. You can use JSONObject to consume this restful service.
An example for using the JSONObject with REST is given in the link:
https://blogs.oracle.com/enterprisetechtips/entry/implementing_restful_web_services_in
http://javapostsforlearning.blogspot.in/2013/04/restful-web-service-tutorial.html
and to call Web Services from Android
http://java.dzone.com/articles/invoke-webservices-android
http://www.codeproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr
beside this lot of stuff you can find out through google!!
for needed tools visit
http://developer.android.com/tools/index.html
http://developer.android.com/tools/help/index.html
I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.
But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.
The problem is that I have no idea how Asp.net web Api is used.
Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.
The whole thing is pretty confusing to me
If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).
For completeness sake, a list of pro's and con's:
Advantages of using an intermediate server
Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
Disadvantages of using an intermediate server
More effort. It will take more effort to develop and host an intermediate server.
Reliability. You must ensure your intermediate server is online and connected to the internet 24/7
Project Description: I have to make an application in android which gets the Latitude and Longitude from GPS and forward their location with identification to server. On the server end there should be web page which continuously receives the messages from the Android application and shows the location on Google maps.
Suppose there are 10 Android devices at different places in which our application is running. On the Server end we have to show 10 markers on Google maps at the location of devices.
What I have Done: I have made an application in android which gets Lat and Long from GPS. I'm familiar with socket programming on android. I've implemented the web page on the server end which has Google maps and shows the markers.
Confusion:
How can I make a server?
How can I transfer data from Android to server and what application required at server end which receive the data from Android. Is any desktop or console application needed which bind it-self at particular port of server, or web page is enough for me to achieve this target.
What protocol do I have to use? UDP, TCP/IP, or use the HTTP or HTTPS steam directly?
I just need some direction about my problem because I have never worked in Android and Client Server Communication. If you think this question is vague then please recommend a book about networking or any which you think is suitable for this type of problem.
A common setting can be like this:
Have following things:
A file (PHP) at server's end, whose sole purpose is to inject the data (lat,lng) received from android devices into a MySql database
A file (PHP) at server's end whose sole purpose is to fetch you the data (lat,lng) from the MySql databse. This file should receive a timestamp as its argument and return all the values of lat,lng who have been saved after that timestamp (For this, your database must store timestamp)
A file (HTML+JS) which just handles the map thing, has an AJAX call implemented which polls the second file at regular intervals with a timestamp value to get new lat,lng values. and when it gets the values, it plots them on the map
On the Android devices, make your app in a way that it keeps sending its location to the first PHP file at a particular time interval.
This way, you get what you wanted.
On the other note, If we talk about client-server architecture, a client sends the request and gets the response. that's it. for this, client accesses a server side script to get those responses. same way, your android app accesses a particular server side script and gets the response. That's it.
In the case when you want to implement server initiated communication to android, you'll have to use push mechanism, like Cloud to Device Messaging (C2DM)
Cheers.
Afaik...
First you need to get the data of GPS by using Location baser services provided in Android SDK(See Location MAnager, Location Listener etc etc...)
Confusion:- The confusion is that
How can I make a server.
Ans: Cant help you with this because i m not expert at configuring servers
How to transfer data from Android to server and what application required at server end which receive the data from Android. Is any desktop or console application needed which bind it-self at particular port of server, or web page is enough for me to achieve this target.
Ans: You can transfer the data that consists of the Latitude and Longitude using a webservice that recieves the data using get or post methods and then dumps it into your database every time the OnLocationChanged method is called on Location Listener. Preferably u can configure a mysql database in your server and then use it for your data storage. The web page you need to design in such a way that it frequently gets the location related data from the database and then display markers accordingly.
What protocol which I have to use UDP or TCP/IP, or use directly the HTTP or HTTPS steam?
Ans: If you are aware of php then u can use REST services or if you are .Net kind of guy you can use a SOAP webservice that uses simple http post methods to update data to the server.
Hope this helps.
I'm new to Android and web service development!
currently I'm working in developing Android program that will send longitude and latitude information to asp.net website (to show the location change the website map)
the questions are
- how to send this data to the website (the best practice)!
- any suggestions for a suitable framework starting from the android application itself , inserting to database , client/server connection !!
I've read a lot about web services specially REST ..but didn't find tutorials
Appreciate your kind help..
I would suggest that you use JSON to encode your data and this will allow you to use any implementation (pretty much) on a server to receive it. I prefer Java/Servlets but you can most certainly find a JSON library for ASP.net etc. Using something "standard" like JSON allows you more flexibility in the long run than doing something custom.
Have a look at this question for some example code to get started (for lat/long): Passing GPS LonLat from Android GPS to WebPage (javascript)
I also suggest that you use POST instead of GET when using HTTP, there is some example Android code here: http://www.anddev.org/doing_http_post_with_android-t492.html and http://www.androidsnippets.org/snippets/36/
Lastly if you need security and you are using HTTP, simply add an SSL certificate to your server and you will then have HTTPS.