Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing location tracking on Android

I am new to Android development and want to build a first sample application. My goal is to build a tracking application which sends my current location to a remote server. I want to use the collected data to calculate how many hours I spend in well known places like home or work.

Which approach should I use? I think it will be sufficient to use the information of present WLANs to get a good idea about the current location I am at. All the places I am interested in have WLAN with a static SSID. Are there any frameworks I should use or is there a better approach to what I am trying to do? GPS is not a real option, because the most interesting places are indoors and I have no GPS connection there.

I am working on Android 4.0.

like image 467
Demento Avatar asked Jan 03 '12 12:01

Demento


3 Answers

As you say, GPS connection doesn`t work indoor, but it is very useful to estimate your current position. How? You could use the function getLastKnownLocation(best) that provides the LocationManager.

If you want to do it by yourself, you could try to get the last position by GPS, to locate a big area, and use the WLANs to estimate it with more accuracy, using the smaller group of radius with your interesting places.

like image 129
vgonisanz Avatar answered Nov 18 '22 17:11

vgonisanz


You might want to read the Making Your App Location Aware training guide on the Android developer site. There's also an included sample application.

like image 38
twaddington Avatar answered Nov 18 '22 15:11

twaddington


I actually am working on a similar project. Here is my code for location tracking on android; check it out. It tracks user's location regularly, uses Network location while indoor, and GPS when it could have a fix. It should give you a quick start.

like image 24
Yulong Avatar answered Nov 18 '22 17:11

Yulong