From 878b06d456f2f0c67c3e751301c77aecca16e0c4 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 6 Apr 2013 01:05:37 +0300 Subject: [PATCH] Make location updates cancelable LocationManager instances are now got from the application context, so canceling always works. --- src/ro/ieval/fonbot/Heavy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ro/ieval/fonbot/Heavy.java b/src/ro/ieval/fonbot/Heavy.java index 3249db8..2e379e0 100644 --- a/src/ro/ieval/fonbot/Heavy.java +++ b/src/ro/ieval/fonbot/Heavy.java @@ -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); -- 2.39.2