public override void OnCreate() { try { base.OnCreate(); //A great place to initialize Xamarin.Insights and Dependency Services! RegisterActivityLifecycleCallbacks(this); instance = this; //Bypass Web Errors //====================================== if (AppSettings.TurnSecurityProtocolType3072On) { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; var client = new HttpClient(new AndroidClientHandler()); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; } if (AppSettings.TurnTrustFailureOn_WebException) { //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; var b = new AesCryptoServiceProvider(); } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); // Check Created My Folder Or Not //====================================== Functions.IMethods.IPath.Chack_MyFolder(); //====================================== //Init Settings Wo_Main_Settings.Init(); //Change the Lang Wo_Main_Settings.SetApplicationLang(AppSettings.Lang); //====================================== //App restarted after crash //====================================== AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser; } catch (Exception exception) { Console.WriteLine(exception); } }
private void AndroidEnvironmentOnUnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e) { try { Intent intent = new Intent(this.activity, typeof(SpalshScreen_Activity)); intent.AddCategory(Intent.CategoryHome); intent.PutExtra("crash", true); intent.SetAction(Intent.ActionMain); intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask | ActivityFlags.ClearTask); PendingIntent pendingIntent = PendingIntent.GetActivity(MainApplication.GetInstance().BaseContext, 0, intent, PendingIntentFlags.OneShot); AlarmManager mgr = (AlarmManager)MainApplication.GetInstance().BaseContext.GetSystemService(Context.AlarmService); mgr.Set(AlarmType.Rtc, JavaSystem.CurrentTimeMillis() + 100, pendingIntent); this.activity.Finish(); JavaSystem.Exit(2); } catch (Exception exception) { Console.WriteLine(exception); } }
public override void OnCreate() { try { base.OnCreate(); //A great place to initialize Xamarin.Insights and Dependency Services! RegisterActivityLifecycleCallbacks(this); Instance = this; Client a = new Client(AppSettings.TripleDesAppServiceProvider); Console.WriteLine(a); var sqLiteDatabase = new SqLiteDatabase(); sqLiteDatabase.CheckTablesStatus(); sqLiteDatabase.Get_data_Login_Credentials(); new Handler(Looper.MainLooper).Post(new Runnable(FirstRunExcite)); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public override void OnCreate() { try { base.OnCreate(); //A great place to initialize Xamarin.Insights and Dependency Services! RegisterActivityLifecycleCallbacks(this); Instance = this; Client a = new Client(AppSettings.TripleDesAppServiceProvider); Console.WriteLine(a); //Bypass Web Errors //====================================== if (AppSettings.TurnSecurityProtocolType3072On) { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; var client = new HttpClient(new AndroidClientHandler()); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13; Console.WriteLine(client); } if (AppSettings.TurnTrustFailureOnWebException) { //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; var b = new AesCryptoServiceProvider(); Console.WriteLine(b); } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); // Check Created My Folder Or Not //====================================== Methods.Path.Chack_MyFolder(); //====================================== //Init Settings MainSettings.Init(); ClassMapper.SetMappers(); //App restarted after crash AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; AppCompatDelegate.CompatVectorFromResourcesEnabled = true; FirebaseApp.InitializeApp(this); Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver); StartService(new Intent(this, typeof(ScheduledApiService))); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); Methods.DialogPopup.InvokeAndShowDialog(Activity, "ReportMode", exception.Message, "Close"); } }