| | |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.Content.PM; |
| | | using Android.Locations; |
| | | using Android.Net; |
| | | using Android.OS; |
| | | using Android.Support.V4.App; |
| | |
| | | { |
| | | base.OnCreate(savedInstanceState); |
| | | |
| | | if(Shared.Application.Activity != null && Shared.Application.Activity.GetType() == typeof(BaseActivity)) |
| | | { |
| | | Finish(); |
| | | return; |
| | | } |
| | | |
| | | //Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class); |
| | | //StartActivityForResult(i, 1); |
| | | //OverridePendingTransition(0, 0); |
| | | //initAll(); |
| | | if (HDL_ON.OnAppConfig.Instance.FirstRunApp || !HDL_ON.OnAppConfig.Instance.isAgreePrivacyPolicy) |
| | | { |
| | | //OnAppConfig.Instance.FirstRunApp = false; |
| | | //OnAppConfig.Instance.SaveConfig(); |
| | | Language.CurrentLanguage = "Chinese"; |
| | | Locale locale1 = Locale.Default; |
| | | var localeList = Resources.Configuration.Locale; |
| | |
| | | JPushInterface.Init(this); |
| | | |
| | | Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83"); |
| | | |
| | | |
| | | |
| | | BaseActivity.OnCreateActoin += (activity, application) => |
| | | { |
| | |
| | | } |
| | | }; |
| | | |
| | | BaseActivity.OnCreateActoin += (activity, application) => |
| | | BaseActivity.OnCreateActoin = (activity, application) => |
| | | { |
| | | Language.CurrentLanguage = "Chinese"; |
| | | Locale locale1 = Locale.Default; |
| | |
| | | HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground); |
| | | }; |
| | | }; |
| | | BaseActivity.RefreshUIAction += (activity) => |
| | | BaseActivity.RefreshUIAction = (activity) => |
| | | { |
| | | Language.CurrentLanguage = "Chinese"; |
| | | Locale locale1 = Locale.Default; |
| | |
| | | MainPage.Show(); |
| | | checkSomeInfo(); |
| | | }; |
| | | BaseActivity.OnResumeAction += (activity) => |
| | | BaseActivity.OnResumeAction = (activity) => |
| | | { |
| | | checkSomeInfo(); |
| | | }; |
| | | BaseActivity.OnDestroyAction += (activity) => |
| | | BaseActivity.OnDestroyAction = (activity) => |
| | | { |
| | | Console.WriteLine("OnDestroyAction"); |
| | | //BusSocket.Stop(); |
| | |
| | | //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); |
| | | //关闭定位服务 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 在你的活动(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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |