2017-03-08 14 views
1

私のアプリでは入力と終了の通知が必要です。私は同じコードの下に書いてあり、期待どおりに働いています。しかし、私は複数のオーバーレイまたは地域を確認したい。xamarin ios用の複数領域のジオフェンシング

例として、3つのオーバーレイまたは特定の座標を持つ領域が設定されています。私は、ユーザーの現在の場所の近くにあるのエントリと終了を確認したいと思います。

  if (pointregion.ContainsCoordinate(location.Coordinate) && Entryregion == false) 
      { 
       Entryregion = true; Exitregion = false; 
       ShowNotification("You are just in " + pointregionname + " region", "Alert"); 
      } 
      if (!pointregion.ContainsCoordinate(location.Coordinate) && Entryregion == true) 
      { 
       Entryregion = false; Exitregion = true; 
       ShowNotification("You are just left " + pointregionname + " region", "Alert"); 
      } 

答えて

0

CLLocation​Managerの領域監視とジオフェンシング領域の設定が必要です。

  1. CLCircularRegionまたは他のCLRegionタイプのリストを作成します。

  2. 各地域ごとにlocationManager.StartMonitoring(yourRegion)を呼び出してすべての地域を追加します。

  3. あなたが特定の地域で行われている場合の領域が入ったりRegionLeft(CLLocationManager manager, CLRegion region)またはRegionEntered(CLLocationManager manager, CLRegion region)デリゲートメソッドが呼び出されます残っている次に際locationManager.StopMonitoring(yourRegion)

を呼び出すことによって、それを削除。これらのメソッドをCLLocationManagerDelegateクラスでオーバーライドする必要があります。

関連する問題