I am trying to get the current location of the user using Mapbox SDK for Android. After reviewing the tutorials and everything else out there available i concluded that all of the techniques that are shown include deprecated methods.
I tried to use the following technique since may be is my only shot but i run to an error which i cannot solve: error: cannot access LocationListener
class file for com.google.android.gms.location.LocationListener not found
.
Here is part of my code that is producing the error:
@Override
protected void onCreate(Bundle savedInstanceState) {
context = this;
super.onCreate(savedInstanceState);
Mapbox.getInstance(this, API_KEY);
setContentView(R.layout.activity_map_view_test);
locationEngine = GoogleLocationEngine.getLocationEngine(context);
myLocation = locationEngine.getLastLocation();
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap mapboxMap) {
mapboxMap.addMarker(new MarkerOptions()
.position(new LatLng(myLocation.getLatitude(),myLocation.getLongitude()))
.title("My Location")
.snippet("Illinois")
);
mapboxMap.setLatLng(mapboxMap.getMarkers().get(0).getPosition());
}
});
}
Does anyone have some bright ideas? Any help is apreciated.
Best regards,
Dimitar Georgiev