Google Maps V2 setLocationSource removes blue MyLocation icon - android

I'm working on an indoor GPS application and I have my own location provider that will give me lat and long. I have google maps v2 working with my location provider by using
mMap.setMyLocationEnabled(true);
mMap.setLocationSource(myLocationProvider);
My problem is as I set the location source to my custom provider, the little blue icon that displays onscreen location no longer functions. Is this expected? Shouldn't google maps just use the lat/long to display the current location, no matter where it comes from?

The blue dot should still be visible.
If you are sure your LocationSource is implemented properly, and after you call OnLocationChangedListener callback method the blue dot does not appear in the location you send, I suggest creating a simple working example to show the issue and post it on gmaps-api-issues.
I would start with a test call in activate:
Location location = new Location("myProvider");
location.setLatitude(30.0);
location.setLongitude(30.0);
listener.onLocationChanged(location);

Related

Blue dot is not shown on MyLocation using android fused location api

I’ve implemented Google map & fuse location API to get current location.
But facing issue like unable to get current location (blue dot) after accepting permission at run time .
This is happened only in fresh installed app, if i kill the app and reopen the app then its works fine.
am i missing something?
Thanks
Enable your location
map.setMyLocationEnabled(true);
Add
map.setMyLocationEnabled(true); in
onRequestPermissionsResult() method So it will update the current location after you accept the permission

Tracking the location in android

I got the current location latitude and longitude while giving on in a switch button in android and displaying the location in google map. But I need the latitude and longitude changes automatically wherever the device moves and the location on the map should change with respect to the position. How is it possible? Can anyone give me a way?
You could have a look at GoogleApiClient.
You can use requestLocationUpdates(...) to get the users position in a given intervall.
You can find more Info here
But honestly you could have find the answer on your own if you googled a bit.

Using LocationListener (with google play service) as service its getting too much false Location

I'm using Google Play Services to get location.
When I set the Location mode to High Accuracy then the map shows the blue dot as wrong but its showing the correct address. and my location manager also getting false location. How can i avoid the false location getting from Location manager?
Query : Is it possible to get location only use GPS by google play service, and omit the location update from WiFi.
![My location is the read marker and current location from Google play service is the blue icon]

How to show notification when hitting a specific latitude and longitude on Google Maps v2

I was able to create a map fragment already. I wonder If I can make my app have the ability to detect if you're within around uhmm, 200 meters of a certain landmark ( lat = 14.650778, long = 121.048117). I wonder if detecting if you are near a landmark is possible and how to implement it by showing a notification. Thanks!
You can do this with the GeoFencing functions of Play Services.
https://developer.android.com/training/location/geofencing.html
Create the notifications with this
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CreateNotification
You can use the the distanceBetween or distanceTo methods of the Location object to find out what is the distance between you desired point and your current position/ clicked location on the map.
and depending on the output, create a notification, you can use this tutorial for notifications:
Notification Tutorial

Android location and Google Settings

so I have been developing this app for a few weeks now using my own handheld device and today I was trying to get Google map to center in on the current user location in my app
map.setMyLocationEnabled(true); //Locate the current position of the user
The setLocationEnabled(true) above should normally show the location of the user on the map and when the GPS button is pressed it will zoom into it. However after I added the following code this does not work anymore it doesn't show the location of the user anymore and I also I notice "Google Settings" was installed onto my device which after looking around was an update by Google so it might not be the code itself. But I do not know if Google Settings is the cause for this.
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = service.getBestProvider(criteria, false);
Location location = service.getLastKnownLocation(provider);
LatLng userLocation = new LatLng(location.getLatitude(),location.getLongitude());
map.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation, 15));
Even after commenting out this block of code the problem still persist. I do not know how to fix this and I hope someone could help me. I am not sure if this has to do with the code itself or just my device, it literally does not get the location of the user at all even though it was working for the past few weeks and it doesn't give any errors or warnings even pressing the GPS button on my map gives nothing no errors or warnings.
EDIT: I tried using an older working version of my code for this app and it still does not work in terms of getting the user location to come up on the map.
Thanks.
Why you dont use:
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(map.getMyLocation().getLatitude(),map.getMyLocation().getLongitude()), 15));
The map store your actual location, so you dont need LocationManager class.

Categories

Resources