HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to design a location tracking App using GPS in Android Studio - source code?

167,924 views October 29, 2018 23:39

Watch on YouTube
ChannelProgrammer World

Description from the creator

This video shows the steps to create an App which uses Google Map to give the precise location of your phone. This app can be used to track your current position. In the initial part of the video it shows how to create API Key to have the access of the google Map.

This custom app works offline based on GPS and you do not need internet connection to get your current location.


For 2nd part of this tutorial please refer to the below video: youtu.be/FknRti6n_F8

Complete Source code is available at:
programmerworld.co/android/design-a-location-tr…

We will be glad to hear from you regarding any query, suggestions or appreciations at: [email protected]


I am pasting the main method code below (for complete class please contact):

public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;

// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));

locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {

try {
latLng = new LatLng(location.getLatitude(), location.getLongitude());

mMap.addMarker(new MarkerOptions().position(latLng).title("My Current Position"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
}
catch (SecurityException e){
e.printStackTrace();
}
}

@Override
public void onStatusChanged(String s, int i, Bundle bundle) {

}

@Override
public void onProviderEnabled(String s) {

}

@Override
public void onProviderDisabled(String s) {

}
};

locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

try {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_UPDATE_TIME, MIN_UPDATES_DISTANCE, locationListener);
}
catch (SecurityException e){
e.printStackTrace();
}
}
}

About this tutorial

Programmer World published this 23:39 video tutorial on October 29, 2018. It has been watched 167,924 times on YouTube.

Category
Education
Duration
23:39
Published
October 29, 2018
Views
167,924
Likes
1,913

Share

This tutorial in other languages