navinkumarbca / android-protips-location

Automatically exported from code.google.com/p/android-protips-location
0 stars 0 forks source link

Preferences: getLong() for Lat/Lng + follow_location_changes #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. in PlacesUpdateService and PassiveLocationChangedReceiver, the type for 
latitude/longitude values stored in SharedPreferences is long. This causes the 
stored values to be clipped losing the decimals.

=> Needs conversion to float, or to be multiplied by 1E6 (microdegrees): 
save in SharedPreferences with prefs.putInt(lat * 1E6)
use with loc.setLatitude(prefsLat / 1E6)
this would be more consistant with GeoPoint's getLatitudeE6() and 
getLongitudeE6() 

2. Compared to this (great!) tutorial, I actually implemented 
SP_KEY_FOLLOW_LOCATION_CHANGES into a Preferences activity. When set to false, 
it creates an
IllegalArgumentException: Receiver not registered 
in disableLocationUpdates() when calling 
unregisterReceiver(locProviderDisabledReceiver)

=> Needs verification or try/catch.

Thanks for this very helpful tutorial. I have also implemented many of the 
issues reported here...

Original issue reported on code.google.com by mudar.no...@gmail.com on 5 Dec 2011 at 11:24