]> iEval git - fonbot.git/commitdiff
Make location updates cancelable
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 5 Apr 2013 22:05:37 +0000 (01:05 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 5 Apr 2013 22:05:37 +0000 (01:05 +0300)
LocationManager instances are now got from the application context,
so canceling always works.

src/ro/ieval/fonbot/Heavy.java

index 3249db8208a37e841c75a35380ac5cd03e5ea066..2e379e0facc570f95078b5062bb60847a98cc5e8 100644 (file)
@@ -939,7 +939,7 @@ final class Heavy {
         * @see LocationManager#requestLocationUpdates(String, long, float, LocationListener)
         */
        public static void location(final Context context, final Address replyTo, final String provider,final long minTime,final float minDistance){
-               final LocationManager man=(LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
+               final LocationManager man=(LocationManager) context.getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
                if(locationListener!=null)
                        nolocation(context, toNonNull(Address.BLACKHOLE));
                Utils.registerOngoing(context, toNonNull(OngoingEvent.LOCATION));
@@ -1049,7 +1049,7 @@ final class Heavy {
         */
        public static void nolocation(final Context context, final Address replyTo){
                Utils.unregisterOngoing(context, toNonNull(OngoingEvent.LOCATION));
-               final LocationManager man=(LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
+               final LocationManager man=(LocationManager) context.getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
                man.removeUpdates(locationListener);
                locationListener=null;
                Utils.sendMessage(context, replyTo, no_longer_listening_for_location_updates);
This page took 0.029885 seconds and 4 git commands to generate.