Thursday, March 6, 2014

Android application for GPS tracking

Hi friends, today we will see one of the most exciting features of Android operating system known as context aware services. This feature makes Android device a much smarter as it knows where exactly it is by using GPS receiver which is in built in Android device.

       Today we will see how when a button is pressed on screen it gives us co-ordinates (latitude and longitude) of our current place. First of all we will create default application and then will make changes in it.
     Files in which we will make changes and new files which we will add are as follows
           3)    Layout/activity_main.xml
           4)    Values/strings.xml

[packages in MainActivity]
[MainActivity class and onCreate() method]
[onClick() method]
[onCreateOptionMenu() method]


[packages of]
[GPSTrack class]
[getLocation() function]
[conditions for co-ordinates]
[store latitude and longitude]

[overrided methods]
[methods for retrieving latitude and longitude]

[activity_main.xml file]

[string.xml file]


[Output of GPSTrack app]

All the code is explained in comments, if then also something is missing please let me know your queries and suggestions will help both of us.