title: How to show my current location using mapbox SDK?
body: <p>I'm trying to use the mapbox SDK to get my current location and set the navigation, but it's not working. I was trying to implement this code following the tutorial from the mapbox website.</p>
  
  <pre><code>public class pos extends AppCompatActivity implements LocationEngineListener, PermissionsListener {
  
  
      private MapView mapView;
  
  
      // variables for adding location layer
      private MapboxMap map;
      private PermissionsManager permissionsManager;
      private LocationLayerPlugin locationPlugin;
      private LocationEngine locationEngine;
      private Location originLocation;
  
  
      // variables for adding a marker
      private Marker destinationMarker;
      private LatLng originCoord;
      private LatLng destinationCoord;
  
  
      // variables for calculating and drawing a route
      private Point originPosition;
      private Point destinationPosition;
      private DirectionsRoute currentRoute;
      private static final String TAG = "DirectionsActivity";
      private NavigationMapRoute navigationMapRoute;
  
  
      //private Button button;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Mapbox.getInstance(this,"pk.eyJ1IjoiaWhkaW5hIiwiYSI6ImNqaDRveHdhcjB1ZTIyd253M2R2MGhwY28ifQ.If9oJq_rILeuaK1sjp9-nw");
          setContentView(R.layout.activity_pos);
          mapView = (MapView) findViewById(R.id.mapView);
          mapView.onCreate(savedInstanceState);
  
  
          mapView.getMapAsync(new OnMapReadyCallback() {
              @Override
              public void onMapReady(final MapboxMap mapboxMap) {
  
  
                  map = mapboxMap;
                  enableLocationPlugin();
  
  
                  originCoord = new LatLng(originLocation.getLatitude(), originLocation.getLongitude());
                  mapboxMap.addOnMapClickListener(new MapboxMap.OnMapClickListener() {
                      @Override
                      public void onMapClick(@NonNull LatLng point) {
                          if (destinationMarker != null) {
                              mapboxMap.removeMarker(destinationMarker);
                          }
                          destinationCoord = point;
                          destinationMarker = mapboxMap.addMarker(new MarkerOptions()
                                  .position(destinationCoord)
                          );
  
  
                          destinationPosition = Point.fromLngLat(destinationCoord.getLongitude(), destinationCoord.getLatitude());
                          originPosition = Point.fromLngLat(originCoord.getLongitude(), originCoord.getLatitude());
                          getRoute(originPosition, destinationPosition);
  
  
                         /* button.setEnabled(true);
                          button.setBackgroundResource(R.color.mapboxBlue);*/
  
  
                      }
  
                      ;
                  });
  
  
                  /*button = findViewById(R.id.startButton);
                  button.setOnClickListener(new View.OnClickListener() {
                      public void onClick(View v) {
                          Point origin = originPosition;
                          Point destination = destinationPosition;
                          // Pass in your Amazon Polly pool id for speech synthesis using Amazon Polly
                          // Set to null to use the default Android speech synthesizer
                          String awsPoolId = null;
                          boolean simulateRoute = true;
                          NavigationLauncherOptions options = NavigationLauncherOptions.builder()
                                  .origin(origin)
                                  .destination(destination)
                                  .awsPoolId(awsPoolId)
                                  .shouldSimulateRoute(simulateRoute)
                                  .build();
  
                          // Call this method with Context from within an Activity
                          NavigationLauncher.startNavigation(NavigationActivity.this, options);
                      }
                  });*/
  
  
              }
  
              ;
          });
  
  
      }
  
  
      private void getRoute(Point origin, Point destination) {
          NavigationRoute.builder()
                  .accessToken(Mapbox.getAccessToken())
                  .origin(origin)
                  .destination(destination)
                  .build()
                  .getRoute(new Callback&lt;DirectionsResponse&gt;() {
                      @Override
                      public void onResponse(Call&lt;DirectionsResponse&gt; call, Response&lt;DirectionsResponse&gt; response) {
                          // You can get the generic HTTP info about the response
                          Log.d(TAG, "Response code: " + response.code());
                          if (response.body() == null) {
                              Log.e(TAG, "No routes found, make sure you set the right user and access token.");
                              return;
                          } else if (response.body().routes().size() &lt; 1) {
                              Log.e(TAG, "No routes found");
                              return;
                          }
  
                          currentRoute = response.body().routes().get(0);
  
                          // Draw the route on the map
                          if (navigationMapRoute != null) {
                              navigationMapRoute.removeRoute();
                          } else {
                              navigationMapRoute = new NavigationMapRoute(null, mapView, map, R.style.NavigationMapRoute);
                          }
                          navigationMapRoute.addRoute(currentRoute);
                      }
  
  
  
                      @Override
                      public void onFailure(Call&lt;DirectionsResponse&gt; call, Throwable throwable) {
                          Log.e(TAG, "Error: " + throwable.getMessage());
                      }
                  });
      }
  
  
      @SuppressWarnings( {"MissingPermission"})
      private void enableLocationPlugin() {
          // Check if permissions are enabled and if not request
          if (PermissionsManager.areLocationPermissionsGranted(this)) {
              // Create an instance of LOST location engine
              initializeLocationEngine();
  
              locationPlugin = new LocationLayerPlugin(mapView, map, locationEngine);
              locationPlugin.setLocationLayerEnabled(true);
          } else {
              permissionsManager = new PermissionsManager(this);
              permissionsManager.requestLocationPermissions(this);
          }
      }
  
      @SuppressWarnings( {"MissingPermission"})
      private void initializeLocationEngine() {
          locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
          locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
          locationEngine.activate();
  
          Location lastLocation = locationEngine.getLastLocation();
          if (lastLocation != null) {
              originLocation = lastLocation;
              setCameraPosition(lastLocation);
          } else {
              locationEngine.addLocationEngineListener(this);
          }
      }
  
      private void setCameraPosition(Location location) {
          map.animateCamera(CameraUpdateFactory.newLatLngZoom(
                  new LatLng(location.getLatitude(), location.getLongitude()), 13));
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
      }
  
      @Override
      public void onExplanationNeeded(List&lt;String&gt; permissionsToExplain) {
  
      }
  
      @Override
      public void onPermissionResult(boolean granted) {
          if (granted) {
              enableLocationPlugin();
          } else {
              finish();
          }
      }
  
      @Override
      @SuppressWarnings( {"MissingPermission"})
      public void onConnected() {
          locationEngine.requestLocationUpdates();
      }
  
      @Override
      public void onLocationChanged(Location location) {
          if (location != null) {
              originLocation = location;
              setCameraPosition(location);
              locationEngine.removeLocationEngineListener(this);
          }
      }
  
      @Override
      @SuppressWarnings( {"MissingPermission"})
      protected void onStart() {
          super.onStart();
          if (locationEngine != null) {
              locationEngine.requestLocationUpdates();
          }
          if (locationPlugin != null) {
              locationPlugin.onStart();
          }
          mapView.onStart();
      }
  
      @Override
      protected void onStop() {
          super.onStop();
          if (locationEngine != null) {
              locationEngine.removeLocationUpdates();
          }
          if (locationPlugin != null) {
              locationPlugin.onStop();
          }
          mapView.onStop();
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          mapView.onDestroy();
          if (locationEngine != null) {
              locationEngine.deactivate();
          }
      }
  
      @Override
      public void onLowMemory() {
          super.onLowMemory();
          mapView.onLowMemory();
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          mapView.onResume();
      }
  
      @Override
      protected void onPause() {
          super.onPause();
          mapView.onPause();
      }
  
      @Override
      protected void onSaveInstanceState(Bundle outState) {
          super.onSaveInstanceState(outState);
          mapView.onSaveInstanceState(outState);
      }
  
  
  }
  </code></pre>