Reputation: 1
I am looking for a solution that when i search for a location and switch to that it must to be indicate my current location via any indicator or image. or When searching another location from current location then How to show the icon indicating the current location side direction in the map.
I am implement google map on my mobile application and search to another location to show Business Unit on map screen. I am trying to show another location Business Unit and current location direction indicator or image.
Upvotes: 0
Views: 14
Reputation: 51
You can use LocationManager to get your current location info (latitude, longitude). Then try to call below method.
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, this);
if (locationManager!=null){
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location!=null){
Log.e("latitude",location.getLatitude()+"");
Log.e("longitude",location.getLongitude()+"");
}
}
Then you can set your google map Camera position with your location info.
LatLng myLatlng = new LatLng(latitude, longitude);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLatlng, 16f));
Upvotes: 0