| | |
| | | public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) |
| | | { |
| | | registerForRemoteNotification(application); |
| | | var musicInfo = new MusicInfo { }; |
| | | Volume.Init(); |
| | | |
| | | if (Shared.Application.IsMusicEnable) |
| | | { |
| | | var musicInfo = new MusicInfo { }; |
| | | Volume.Init(); |
| | | } |
| | | |
| | | FinishedLaunchingAction?.Invoke(application, launchOptions); |
| | | |
| | | //GPS |
| | | if (Shared.Application.IsGpsEnable) |
| | | { |
| | | if (MyCLLocationManager.Instance.IsLocationServicesEnabled) |
| | | { |
| | | switch (Shared.Application.CurrentGpsUseMode) |
| | | { |
| | | case Application.GpsUseMode.Always: |
| | | MyCLLocationManager.Instance.RequestAlwaysAuthorization(); |
| | | break; |
| | | case Application.GpsUseMode.WhenInUse: |
| | | MyCLLocationManager.Instance.RequestWhenInUseAuthorization(); |
| | | break; |
| | | } |
| | | if (launchOptions != null && launchOptions.ObjectForKey(UIApplication.LaunchOptionsLocationKey) != null) |
| | | { |
| | | MyCLLocationManager.Instance.StartMonitoringSignificantLocationChanges(); |
| | | } |
| | | else |
| | | { |
| | | MyCLLocationManager.Instance.StartUpdatingLocation(); |
| | | } |
| | | } |
| | | else { |
| | | ///TODO 可以提示用户打开定位权限 |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | |
| | | locationManager = new MyCLLocationManager(); |
| | | //设置是否允许系统自动暂停定位 |
| | | locationManager.PausesLocationUpdatesAutomatically = false; |
| | | //locationManager.AllowsBackgroundLocationUpdates = true; |
| | | locationManager.AllowsBackgroundLocationUpdates = true; |
| | | //设置定位精度 |
| | | locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer; |
| | | locationManager.init(); |
| | |
| | | { |
| | | var location = e.Locations[e.Locations.Length - 1]; |
| | | //adjustDistanceFilter(location); |
| | | System.Console.WriteLine($"位置信息变化 经度{location.Coordinate.Longitude} 纬度{location.Coordinate.Latitude}"); |
| | | //Shared.HDLUtils.WriteLine($"位置信息变化 经度{location.Coordinate.Longitude} 纬度{location.Coordinate.Latitude}"); |
| | | uploadToServer(location); |
| | | }; |
| | | |