当前位置: 首页>>代码示例>>C#>>正文


C# CLLocationManager.StartMonitoringSignificantLocationChanges方法代码示例

本文整理汇总了C#中CLLocationManager.StartMonitoringSignificantLocationChanges方法的典型用法代码示例。如果您正苦于以下问题:C# CLLocationManager.StartMonitoringSignificantLocationChanges方法的具体用法?C# CLLocationManager.StartMonitoringSignificantLocationChanges怎么用?C# CLLocationManager.StartMonitoringSignificantLocationChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLLocationManager的用法示例。


在下文中一共展示了CLLocationManager.StartMonitoringSignificantLocationChanges方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _locationManager = new CLLocationManager();
            _locationManager.Delegate = new MyLocationDelegate();

            // Enable location mode, request if not authorized
            if (CLLocationManager.Status == CLAuthorizationStatus.AuthorizedAlways) {
                _locationManager.StartMonitoringSignificantLocationChanges ();
            } else {
                _locationManager.RequestAlwaysAuthorization ();
            }
        }
开发者ID:bytedreamer,项目名称:BusyBot-iOS,代码行数:14,代码来源:MainTabBarController.cs

示例2: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			// Perform any additional setup after loading the view, typically from a nib.

			var LocationManager = new CLLocationManager();
			LocationManager.RequestWhenInUseAuthorization ();
			LocationManager.RequestAlwaysAuthorization ();

			CLCircularRegion region = new CLCircularRegion (new CLLocationCoordinate2D (+46.833120, +15.34901), 1000.0, "FF Gussendorf");

			if (CLLocationManager.LocationServicesEnabled) {

				LocationManager.DidStartMonitoringForRegion += (o, e) => {
					Console.WriteLine ("Now monitoring region {0}", e.Region.ToString ());
				};

				LocationManager.RegionEntered += (o, e) => {
					Console.WriteLine ("Just entered " + e.Region.ToString ());
				};

				LocationManager.RegionLeft += (o, e) => {
					Console.WriteLine ("Just left " + e.Region.ToString ());
				};

				LocationManager.Failed += (o, e) => {
					Console.WriteLine (e.Error);
				};

				LocationManager.UpdatedLocation += (o, e) => {
					Console.WriteLine ("Lat " + e.NewLocation.Coordinate.Latitude + ", Long " + e.NewLocation.Coordinate.Longitude);
				};

				LocationManager.LocationsUpdated += (o, e) => Console.WriteLine ("Location change received");

				LocationManager.StartMonitoring (region);
				LocationManager.StartMonitoringSignificantLocationChanges ();

				//LocationManager.StopMonitoringSignificantLocationChanges ();



			} else {
				Console.WriteLine ("This app requires region monitoring, which is unavailable on this device");
			}
		}
开发者ID:martinlipp,项目名称:GeoFence,代码行数:46,代码来源:ViewController.cs

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            this.locationManager = new CLLocationManager();
            locationManager.StartMonitoringSignificantLocationChanges();
            tapitAd.WillLoadAd += HandleWillLoadAd;

            tapitAd.DidFinish += HandleDidFinish;

            tapitAd.DidLoadAd += HandleDidLoadAd;
            tapitAd.FailedToReceiveAd += HandleFailedToReceiveAd;
            NSDictionary parameters = NSDictionary.FromObjectAndKey( new NSString("test"),new NSString("mode"));
            request = TapItRequest.FromZone(AppDelegate.ZoneId,parameters);
            if(locationManager.Location != null)
                request.UpdateLocation(locationManager.Location);
            tapitAd.StartServingAds(request);

            button.TouchDown += HandleTouchDown;
        }
开发者ID:kato-im,项目名称:monotouch-bindings,代码行数:18,代码来源:FirstViewController.cs

示例4: AuthorizationChanged

 public override void AuthorizationChanged(CLLocationManager manager, CLAuthorizationStatus status)
 {
     if (CLLocationManager.Status == CLAuthorizationStatus.AuthorizedAlways) {
         manager.StartMonitoringSignificantLocationChanges ();
     }
 }
开发者ID:bytedreamer,项目名称:BusyBot-iOS,代码行数:6,代码来源:MainTabBarController.cs

示例5: GeofenceImplementation

      /// <summary>
      /// Geofence plugin iOS implementation
      /// </summary>
      public GeofenceImplementation()
      {

          mGeofenceResults = new Dictionary<string, GeofenceResult>();

          locationManager = new CLLocationManager();
          locationManager.DidStartMonitoringForRegion += DidStartMonitoringForRegion;
          locationManager.RegionEntered += RegionEntered;
          locationManager.RegionLeft +=RegionLeft;
          locationManager.Failed += OnFailure;
          locationManager.DidDetermineState += DidDetermineState;
          locationManager.LocationsUpdated += LocationsUpdated;
          string priorityType = "Balanced Power";
          switch(CrossGeofence.GeofencePriority)
          {
              case GeofencePriority.HighAccuracy:
                  priorityType = "High Accuracy";
                  locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
                  break;
              case GeofencePriority.AcceptableAccuracy:
                  priorityType = "Acceptable Accuracy";
                  locationManager.DesiredAccuracy = CLLocation.AccuracyNearestTenMeters;
                  break;
              case GeofencePriority.MediumAccuracy:
                  priorityType = "Medium Accuracy";
                  locationManager.DesiredAccuracy = CLLocation.AccuracyHundredMeters;
                  break;
              case GeofencePriority.LowAccuracy:
                  priorityType = "Low Accuracy";
                  locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer;
                  break;
              case GeofencePriority.LowestAccuracy:
                  priorityType = "Lowest Accuracy";
                  locationManager.DesiredAccuracy = CLLocation.AccuracyThreeKilometers;
                  break;
              default:
                  locationManager.DesiredAccuracy = CLLocation.AccurracyBestForNavigation;
                  break;
          }
          System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}: {2}", CrossGeofence.Id, "Location priority set to", priorityType));
    
          if(CrossGeofence.SmallestDisplacement>0)
          {
              locationManager.DistanceFilter = CrossGeofence.SmallestDisplacement;
              System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}: {2} meters", CrossGeofence.Id, "Location smallest displacement set to", CrossGeofence.SmallestDisplacement));
          }

         

          if (locationManager.MonitoredRegions.Count > 0 && IsMonitoring)
          {

              NSSet monitoredRegions = locationManager.MonitoredRegions;
             

              foreach (CLCircularRegion region in monitoredRegions)
              {
                  //If not on regions remove on startup since that region was set not persistent
                  if (!Regions.ContainsKey(region.Identifier))
                  {
                      locationManager.StopMonitoring(region);
                  }
                  else
                  {
                      locationManager.RequestState(region);
                  }
                 
              }

              locationManager.StartMonitoringSignificantLocationChanges();

              string message = string.Format("{0} - {1} {2} region(s)", CrossGeofence.Id, "Actually monitoring", locationManager.MonitoredRegions.Count);
              System.Diagnostics.Debug.WriteLine(message);
              
          }

          SetLastKnownLocation(locationManager.Location);
          
      }
开发者ID:lampshade9909,项目名称:xamarin-plugins,代码行数:82,代码来源:GeofenceImplementation.cs


注:本文中的CLLocationManager.StartMonitoringSignificantLocationChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。