wxr
2023-07-06 203c3a3ffde6259413d9743f6a723b95b1e7989c
HDL-ON_Android/SplashActivity.cs
@@ -3,6 +3,7 @@
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Locations;
using Android.Net;
using Android.OS;
using Android.Support.V4.App;
@@ -23,6 +24,10 @@
    [IntentFilter(new string[] { "com.hdl.onpro.SplashActivity", Intent.ActionView })]
    public class SplashActivity : Activity
    {
        protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
        {
            if (requestCode == 99)
@@ -126,7 +131,7 @@
            JPushInterface.Init(this);
            Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
            BaseActivity.OnCreateActoin += (activity, application) =>
            {
@@ -275,20 +280,20 @@
            //Shared.Application.IsGpsEnable = true;
            //bool isfirst = true;
            var isfirst = true;
            //获取经纬度 
            Shared.Application.LocationAction = (lon, lat) =>
            {
                try
                {
                    //if (isfirst)
                    //{
                    //    //只触发一次
                    //    //Shared.Application.LocationAction = null;
                    //    new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", "."));
                    //}
                    //isfirst = false;
                    if (isfirst)
                    {
                        //只触发一次
                        new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", "."));
                    }
                    isfirst = false;
                    ///监听经纬度
                    HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.Current.AppLatAndLonEvent(lon, lat);
                    //关闭定位服务
@@ -410,7 +415,36 @@
        }
        // 在你的活动(Activity)或片段(Fragment)中的某个方法中,开始监听位置变化
        void StartLocationUpdates()
        {
            // 创建位置管理器
            var locationManager = (LocationManager)GetSystemService(Context.LocationService);
            // 设置位置监听器
            var locationListener = new MyLocationListener_V2();
            // 请求位置更新
            locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 0, 0, locationListener);
        }
        // 在你的活动(Activity)或片段(Fragment)中的某个方法中,停止监听位置变化
        void StopLocationUpdates()
        {
            // 创建位置管理器
            var locationManager = (LocationManager)GetSystemService(Context.LocationService);
            // 设置位置监听器
            var locationListener = new MyLocationListener_V2();
            // 停止位置更新
            locationManager.RemoveUpdates(locationListener);
        }
    }
}