Gps tracking application data send methods - android

I want to create client-server GPS tracking application that clients send location data to server and server saves them on database and show clients location fleet location for site users and give report for them.
In this application i don't know which method i can use.Client applications is android apps and server application is web based application.
Methods for send data from clients to server:
1)Consume web service in clients and send data to server by means of web service
2)Use MQTT in client application and send data with MQTT
in 1st method because data is little when a web service want to send that data to server use XML and this can increase data sizes! and web server for obtain location data first need to decompress them and get location data from web service package that this can use server resources!.But method 2st send location data direct to server but hard to implement and encoding!
which of the methods you offer for me to use in this application?
another concern is if i want to scale this application for other client side platforms like iphone which of above methods is optimum

Have you thought on using a REST service instead ?
So your tracking device will basically just call a REST url and POST data to it.
No overload of data size or compression.
Same REST service can be consumed by an Android or iPhone app.

Related

How do I connect my Android app to backend?

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.

what is the best way to transfer data from android app to a database on server?

I have a game for Android device and I want to upload highscore to a server.
So far I am using url to transfer data to a php file on server which puts data to db, this is not secure as anyone can change url and make highscore .
What is the most common way to do so , is direct db connection in app secure ??
Thanks
-----edit-----
What if I want to upload large amount of data for example I want to backup sms nd contacts on a server, and I want the sms to be uploaded as soon as it arrives.
If you do not care the delay between sending data and storing to database you can use Google's GCM service. Then all the security issues are handled by Google: You send a GCM Bundle to your server via Google Cloud. But there might be a delay between sending on the device and receiving the data on the server.
Some links that will help you:
http://developer.android.com/google/gcm/ccs.html
http://javapapers.com/android/google-cloud-messaging-gcm-ccs-with-xmpp/
But you need a server with a running GCM server programm (Java but also possible in Python and even PHP).

Which Should i use for communication of android and a php

Iam making an location app in android, i want to send the user location data to server and also server can send data to user apllication. which should i use soap or rest?
If your services are resource oriented (i.e. you can express them as CRUD operations over a set of entities), then use REST. If your services are method oriented, and you need a rigid interface contract, use SOAP.

Data exchange between android app and web service

I have an Android app with some data (consisting in latitude and longitude) and a RAILS web service with a MySQL database... I want to know how to send this data to my database
You need an web server with logic implementation to accept/update/delete data from mysql server either by using Java/PHP etc...You need to specify internet permission in your manifest file. And follow the link below for more detail how to make PHP server sends data to an Android device
Rails exposes REST APIs that you can use to send data to your server. There should be an api that accepts post requests and updates the data on your web application's database. Ask your rails developer for the url.
Make a REST post/put call to your webservice.You can use Android httpclient to make a connection. The api is available here
http://developer.android.com/reference/android/net/http/AndroidHttpClient.html
As always, don't forget to turn on your internet permission and perform your network tasking within AsyncTask or another thread to prevent UI thread blocking.

Android Client Server Communication Confusion

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.

Categories

Resources