wxr
2024-09-14 c00da77d00a479fa5d022346a6d9075f90a5c087
HDL-ON_Android/SplashActivity.cs
@@ -9,13 +9,7 @@
using Android.Support.V4.App;
using Android.Support.V4.Content;
using CN.Jpush.Android.Api;
//using Android.Widget;
using Com.Hdl.ON.Jpush.Androidjpush;
using HDL_ON;
using Java.Util;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Shared;
namespace HDL_ON_Android
@@ -24,12 +18,9 @@
    [IntentFilter(new string[] { "com.hdl.onpro.SplashActivity", Intent.ActionView })]
    public class SplashActivity : Activity
    {
        protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
        {
            Console.WriteLine("123456");
            if (requestCode == 99)
            {
                if (resultVal == Result.Ok)
@@ -52,16 +43,27 @@
        [Obsolete]
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Console.WriteLine("123456");
            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 DEBUG
            HDL_ON.OnAppConfig.Instance.isAgreePrivacyPolicy = true;
#endif
            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;
                Console.WriteLine("当前语言缩写:" + localeList.Language);
                if (localeList.Language == "zh")
@@ -80,6 +82,10 @@
                {
                    Language.CurrentLanguage = "български";
                }
                //else if (localeList.Language == "uk")
                //{
                //    Language.CurrentLanguage = "Ukraine";
                //}
                else
                {
                    Language.CurrentLanguage = "English";
@@ -122,7 +128,7 @@
        void initOhterSdk()
        {
            //注册未处理异常事件
            AppCenter.Start("64ac5859-2cd7-4ef8-a5da-5455e29679ec", typeof(Analytics), typeof(Crashes));
            //AppCenter.Start("64ac5859-2cd7-4ef8-a5da-5455e29679ec", typeof(Analytics), typeof(Crashes));
            //手机名称 Android.OS.Build.Manufacturer;
            //OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
            //#if DEBUG
@@ -130,7 +136,7 @@
            //#endif
            JPushInterface.Init(this);
            Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
            //Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
            
            BaseActivity.OnCreateActoin += (activity, application) =>
@@ -140,10 +146,17 @@
            };
            //初始化友盟sdk
            Com.Hdl.Umsdk.UmSdk.InitUmSdk(this, "61d565d9e0f9bb492bbc3d5a", "Android");
            //初始化友盟sdk config
            Com.Hdl.Umsdk.UmSdk.InitUMConfigure(this, "61d565d9e0f9bb492bbc3d5a", "Android", "");
            try
            {
                //初始化友盟sdk
                Com.Hdl.Umsdk.UmSdk.InitUmSdk(this, "61d565d9e0f9bb492bbc3d5a", "Android");
                ////初始化友盟sdk config
                Com.Hdl.Umsdk.UmSdk.InitUMConfigure(this, "61d565d9e0f9bb492bbc3d5a", "Android", "");
            }
            catch (Exception ex)
            {
                Console.WriteLine("初始化友盟SDK异常:" + ex.Message);
            }
        }
@@ -185,10 +198,9 @@
                }
            };
            BaseActivity.OnCreateActoin += (activity, application) =>
            BaseActivity.OnCreateActoin = (activity, application) =>
            {
                Language.CurrentLanguage = "Chinese";
                Locale locale1 = Locale.Default;
                var localeList = Resources.Configuration.Locale;
                Console.WriteLine("当前语言编号" + localeList.Language);
                if (localeList.Language == "zh")
@@ -207,6 +219,10 @@
                {
                    Language.CurrentLanguage = "български";
                }
                //else if (localeList.Language == "uk")
                //{
                //    Language.CurrentLanguage = "Ukraine";
                //}
                else
                {
                    Language.CurrentLanguage = "English";
@@ -234,10 +250,9 @@
                    HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground);
                };
            };
            BaseActivity.RefreshUIAction += (activity) =>
            BaseActivity.RefreshUIAction = (activity) =>
            {
                Language.CurrentLanguage = "Chinese";
                Locale locale1 = Locale.Default;
                var localeList = Resources.Configuration.Locale;
                Console.WriteLine("当前语言:" + localeList.Language);
                if (localeList.Language == "zh")
@@ -256,6 +271,10 @@
                {
                    Language.CurrentLanguage = "български";
                }
                //else if (localeList.Language == "uk")
                //{
                //    Language.CurrentLanguage = "Ukraine";
                //}
                else
                {
                    Language.CurrentLanguage = "English";
@@ -263,11 +282,11 @@
                MainPage.Show();
                checkSomeInfo();
            };
            BaseActivity.OnResumeAction += (activity) =>
            BaseActivity.OnResumeAction = (activity) =>
            {
                checkSomeInfo();
            };
            BaseActivity.OnDestroyAction += (activity) =>
            BaseActivity.OnDestroyAction = (activity) =>
            {
                Console.WriteLine("OnDestroyAction");
                //BusSocket.Stop();
@@ -319,7 +338,7 @@
            {
                //保存获取的极光服务器上的注册ID到本地文件
                var tokenID = JPushInterface.GetRegistrationID(activity);
                Console.WriteLine("RegistrationID:  " + tokenID);
                Console.WriteLine("极光推送Id:  " + tokenID);
                if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
                {
                    OnAppConfig.Instance.PushDeviceToken = tokenID;
@@ -333,14 +352,13 @@
                    {
                        System.Threading.Thread.Sleep(1000);
                        tokenID = JPushInterface.GetRegistrationID(activity);
                        Console.WriteLine("Sleep.tokenID + " + JPushInterface.GetRegistrationID(activity));
                        loadTokenCount++;
                        if (loadTokenCount > 30)
                        {
                            break;
                        }
                    }
                    Console.WriteLine("RegistrationID:  " + tokenID);
                    Console.WriteLine("极光推送Id:  " + tokenID);
                    if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
                    {
                        OnAppConfig.Instance.PushDeviceToken = tokenID;