From 10ef74e90cb5fc66e32db0b20f2e81a711886c1f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 14 七月 2020 16:53:51 +0800
Subject: [PATCH] 2020-07-14-1
---
Shared.IOS/BaseApplicationDelegate.cs | 40 ++++++++++++++++++++++++++++++++++++----
1 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/Shared.IOS/BaseApplicationDelegate.cs b/Shared.IOS/BaseApplicationDelegate.cs
index 077856f..904144b 100644
--- a/Shared.IOS/BaseApplicationDelegate.cs
+++ b/Shared.IOS/BaseApplicationDelegate.cs
@@ -21,10 +21,42 @@
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;
}
@@ -61,7 +93,7 @@
locationManager = new MyCLLocationManager();
//璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅
locationManager.PausesLocationUpdatesAutomatically = false;
- //locationManager.AllowsBackgroundLocationUpdates = true;
+ locationManager.AllowsBackgroundLocationUpdates = true;
//璁剧疆瀹氫綅绮惧害
locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer;
locationManager.init();
@@ -93,7 +125,7 @@
{
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);
};
--
Gitblit v1.8.0