Creating a TrackMe App

 

TrackMe App

Looking something to develop for a Roadie, 
Hurray ! This One is for you.💖

A great and easy to built app which proves to be a great partner of  roadies and which puts wanderlust one step forward.


Its a beginner-friendly, easy to use, and a knowledgeable project.



So, lets Discuss what it exactly is :

                          TrackMe App is a Single Activity app built in Android Studio Framework using Java. It can be a great friend while travelling and can be used by Hikers, travellers or anyone who wants to know his/her current location.
      It shows the users, their current Latitude , Longitude , Altitude , Accuracy and Address(if registered on google maps).


Lets understand the basic features used in the project :

 LOCATION MANAGER : It is built in class which provides access to the location services. Reference can be obtained from calling the getSystemService() method. 

Some more methods of location manager are used like get getLastKnownLocation() which provides the last location saved in it and also requestLocationUpdates() is used to requests for updates of the new location.

 

LOCATION LISTENER : It receives notifications everytime the location changes and the new location populates our TextViews whose chunk of code is written in Location Listener method onLocationChanged(Location location).


GEOCODER : Geocoder is used to transform the street address or any other description into its location cordinates(latitude, longitude). 
So, we have used REVERSE GEOCODING . So it transforms the cordinates into a address using method getFromLocation(). Further we have various methods like  getLocality(), getAdminArea() , etc which are used to give the corresponding details of the address.


For More details , go to android developers official site : https://developer.android.com/guide

  

 

Now take a deep breath and takeoff to the implementation part :


 TO-DO :

          1. Create a new project

          2. Add Permissions in manifest file

          3. Work on UI.

          4. Refer to my Repos.




So, Get ready with your Android studio and lets dive.


1. Create a new project.

     Create a fresh new project for our great journey, choose any suitable name for your project and write MainActivty.java for the class name. 



2. Declare Permissions in Manifest file.

     Open Manifest file from project > Android > app > manifest > AndroidManifest.xml.

     Add these permissions as they are to request foreground location access.



      ACCESS_COARSE_LOCATION provides location accuracy to within a city block.
      ACCESS_FINE_LOCATION provides more accurate location than ACCESS_COARSE_LOCATION.



3. Work on UI.

      Lets go to project > Android > app >  res > layout > activity_main_layout.xml 
      
      You will get a blank white background layout with the one TextView. Delete the TextView.

      Now, to make your screen fancy or attractive, add a background image -
      Right click on drawable from project > Android > app > res > drawable and select                                  show in explorer. It will open up a folder and then , import your cherishing background image in
that folder.
      Rename the image as wallpaper ( you can use any name, this name is told as we have added our background image using this name ).

      After adding xml code(Refer to Github link) for the layout , you will get below layout :



Woahh ! what a wonderfull layout we got.😍

Now get the code of MainActivity.java class from my Repo from Github Link given in the end.

Enable GPS and run your app.

Here is what our App will look like : 







Thank you folks ! 💝





     




      




Comments