Bug 32557 - CLLocationManager.RegionEntered and CLLocationManager.RegionLeft are not called
Summary: CLLocationManager.RegionEntered and CLLocationManager.RegionLeft are not called
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-29 05:04 UTC by Adam Hartley [MSFT]
Modified: 2016-01-28 16:40 UTC (History)
8 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample (90.61 KB, application/zip)
2015-07-29 05:04 UTC, Adam Hartley [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Adam Hartley [MSFT] 2015-07-29 05:04:56 UTC
Created attachment 12264 [details]
Sample

## Overview

When monitoring a region for geofencing with CLLocationManager, RegionEntered is not called when entering the region and RegionLeft is not called when leaving the region.

## Steps to reproduce

1. Run attached sample (GeofencingXam) in the simulator
2. Tap the button to start monitoring
3. Change the location to "Apple" or Lat: 37.29430502 Lon: -122.09423697
4. Change the location to anything away from the previous location

## Expected result

A message should be written to the console to say that the region has been entered, then another for exiting.

## Actual result

No message as the methods are never called

## Notes 

Included in the zip is GeofencingObjC which is an Objective-C sample along the same lines as the Xamarin sample.

If you run the app, do the location changes in steps 3 and 4 above, you will see the label being updated accordingly.
Comment 1 Sebastien Pouliot 2015-07-29 12:06:37 UTC
I do not get the ObjC app to work (label says "Label") on the simulator (Xcode 6.4 / iOS 8.4) even when changing the location.

Please include all version information (from XS about box)
Comment 2 Adam Hartley [MSFT] 2015-07-29 14:22:53 UTC
I have just tested the obj-c sample and it does work for me. I have noticed that it appears to take a while to realise it has entered the region. Xcode 6.4 and iOS 8.4.

Entered: https://drive.google.com/open?id=0B3WrxROLAJ68VnZBN29Qb0ZhSDQ
Exited: https://drive.google.com/open?id=0B3WrxROLAJ68X1YyRjAtLUJEZTA

Version info:

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 9932d50e-3095-4eb8-a4d2-d3b271c86a02
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.3.2 (Business Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Android ===

Version: 5.1.4.16 (Business Edition)
Android SDK: /Users/Adam/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.35 (Business Edition)

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.4
Darwin Adams-Retina-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 3 Colby Williams 2015-10-01 17:17:41 UTC
Changing status back to NEW, as it looks like Adam supplied the requested information.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2016-01-28 16:40:33 UTC
This works fine for me: https://www.dropbox.com/s/4n3qg3dmnyka2n1/bug32557.mov?dl=0

There is a quirk with the simulator though: clicking in the menu Debug -> Location -> Apple does not give any notification (neither if it should be leaving the region, nor entering).

So every time I want to enter the Apple location, I click first Apple, then Custom Location (which will now have the coordinates for the Apple location). Apparently selecting the coordinates for the Apple location as a custom location works just fine.