Reputation: 397
My app has a tab which opens Google Maps and shows markers of the sightseeings around the user. When I open the tab it should show user's current location. It does show it on Android 6.0.1 correctly, but when I try it on 4.2.2 or 4.4.2 for example it shows the users location with around 30km (18miles) longitude difference to North (the latitude is fine). All of the phones have Location and Wi-Fi turned on and are connected to the same Wi-Fi network. Also in MapReady I have set setMyLocationEnabled to true, so it should be working, but it's not. Any suggestions what's causing this?
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setMyLocationEnabled(true);
Upvotes: 0
Views: 428
Reputation: 3040
I don't think the OS version of the phone or your code is an issue. I have used Samsung Duos and other phones using 4.4.2 and lower and I haven't had issues with the location.
When in High accuracy mode the phones can fetch data through WiFi or mobile networks which is not always accurate.
There have been instances where the location is shown incorrectly when the wifi router has been moved.
I have also faced this issue when my router at home stopped working and I borrowed the backup router from office. Google Maps showed that I was in office when I was at home!
To combat this you can try turning off location retrieval from Wifi and mobile networks by changing the Location Mode on the phones from High accuracy to Device only. This will force the device the to fetch locations from GPS satellites only which will require the phones to be near the window or someplace with an open sky.
Test your app on Device only and let me know if you still face the same issue.
Upvotes: 1