public override void OnCreate() { base.OnCreate(); CommonMethods.LogStatic("Application OnCreate"); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); }
public override void OnCreate() { base.OnCreate(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); _preferences = new PreferenceWrapper(Context); IsLocked = true; }
public override void OnCreate() { try { 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); } catch (Exception exception) { Console.WriteLine(exception); } }
public override void OnCreate() { try { base.OnCreate(); Instance = this; //A great place to initialize Xamarin.Insights and Dependency Services! RegisterActivityLifecycleCallbacks(this); Instance = this; Client client = new Client(AppSettings.Cert); Console.WriteLine(client); if (AppSettings.TurnSecurityProtocolType3072On) { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; HttpClient clientHttp = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler()); Console.WriteLine(clientHttp); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13 | SecurityProtocolType.Ssl3; } 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; System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider(); Console.WriteLine(b); } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); //Init Settings SharedPref.Init(); ClassMapper.SetMappers(); //App restarted after crash AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; FirebaseApp.InitializeApp(this); Methods.Path.Chack_MyFolder(); Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver); } catch (Exception exception) { Console.WriteLine(exception); } }
public override void OnCreate() { DefaultNightMode = QApis.AreAvailable ? ModeNightFollowSystem : ModeNightAuto; base.OnCreate(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); #if !DEBUG Firebase.FirebaseApp.InitializeApp(this); #endif AndroidDependencyContainer.EnsureInitialized(Context); var app = new AppStart(AndroidDependencyContainer.Instance); app.LoadLocalizationConfiguration(); var accessLevel = app.GetAccessLevel(); app.SetupBackgroundSync(); app.SetFirstOpened(); if (accessLevel == AccessLevel.TokenRevoked || accessLevel == AccessLevel.LoggedIn) { AndroidDependencyContainer.Instance .UserAccessManager .LoginWithSavedCredentials(); } var accessibilityManager = GetSystemService(AccessibilityService) as AccessibilityManager; if (accessibilityManager != null) { var accessibilityEnabled = accessibilityManager.IsTouchExplorationEnabled; AndroidDependencyContainer.Instance.AnalyticsService.AccessibilityEnabled.Track(accessibilityEnabled); } #if USE_APPCENTER Microsoft.AppCenter.AppCenter.Start( "{TOGGL_APP_CENTER_ID_DROID}", typeof(Microsoft.AppCenter.Crashes.Crashes), typeof(Microsoft.AppCenter.Analytics.Analytics)); #endif #if DEBUG // Add or remove `Detect*` chains to detect unwanted behaviour // Change the `Penalty*` to change how the StrictMode works, allowing it to crash the app if necessary // Try not to misinterpret the logs/penalties; You should only be looking for behaviour that shouldn't // be happening Android.OS.StrictMode.SetVmPolicy( new Android.OS.StrictMode.VmPolicy.Builder() .DetectActivityLeaks() .DetectLeakedClosableObjects() .DetectLeakedRegistrationObjects() .DetectLeakedSqlLiteObjects() .PenaltyLog() .Build()); Android.OS.StrictMode.SetThreadPolicy( new Android.OS.StrictMode.ThreadPolicy.Builder() .DetectCustomSlowCalls() .PenaltyLog() .Build()); #endif }
public override void OnCreate() { base.OnCreate(); AppDomain.CurrentDomain.UnhandledException += OnCurrentDomainUnhandledException; AndroidEnvironment.UnhandledExceptionRaiser += OnAndroidEnvironmentUnhandledExceptionRaised; TaskScheduler.UnobservedTaskException += OnTaskSchedulerUnobservedTaskException; ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); _preferences = new PreferenceWrapper(Context); }
public async Task <string> StartUploadForIdAsync(Guid id) { Data.Builder data = new Data.Builder(); data.PutString("id", id.ToString()); OneTimeWorkRequest oneTimeWorkRequest = OneTimeWorkRequest.Builder.From <RandomUploadWorker>() .SetInputData(data.Build()) .Build(); WorkManager.Instance.Enqueue(oneTimeWorkRequest); ILifecycleOwner owner = ProcessLifecycleOwner.Get(); //Observe what happened to this request so we can notify the UI WorkManager.Instance.GetWorkInfoByIdLiveData(oneTimeWorkRequest.Id).Observe(owner, new RandomWorkerObserver()); return(oneTimeWorkRequest.Id.ToString()); }
public override void OnCreate() { base.OnCreate(); SQLitePCL.Batteries_V2.Init(); AppCenter.Start("2069a171-32ec-4432-b8d5-31d5ce74fb82", typeof(Analytics), typeof(Crashes)); Globals.Loggers = new LoggerFactory().AddSentry(config => { config.Dsn = "https://[email protected]/5174354"; config.Environment = "Android"; config.Release = this.GetPackageVersion(); }); #if DEBUG Crashes.SetEnabledAsync(false); #endif var databasePath = Path.Combine(Context.FilesDir.AbsolutePath, "Preferences.sqlite3"); Globals.Database = new SQLiteConnection(databasePath, SQLiteOpenFlags.Create | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.FullMutex); Globals.Database.CreateTable <KeyValueModel>(); Globals.Database.CreateTable <CloudModel>(); Globals.Database.CreateTable <AlibabaOSS>(); Globals.Database.CreateTable <AzureBlob>(); Globals.Database.CreateTable <WebApp>(); Globals.Database.CreateTable <BackupRecord>(); Globals.Database.SaveSetting(UserSettings.PhotoBackupInterval, "1"); if (Globals.Database.Find <KeyValueModel>(UserSettings.EnableSharing) is null) { Globals.Database.SaveSetting(UserSettings.EnableSharing, "1"); } Globals.Storage = new AndroidDataStorage(); wifiMonitor = new WiFiStateReceiver(); var filter = new IntentFilter(); filter.AddAction(WifiManager.NetworkStateChangedAction); RegisterReceiver(wifiMonitor, filter); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); }
public DroidPushNotificationsService( IRemotePushNotificationsService remotePushNotificationsService, IPushTokenStorageService pushTokenStorageService, IPushNotificationsHandler pushNotificationsHandler, IPushNotificationParser pushNotificationParser, INotificationsSettingsProvider notificationsSettings, ILogManager logManager) : base( remotePushNotificationsService, pushTokenStorageService, pushNotificationsHandler, pushNotificationParser, logManager) { _appContext = Application.Context; NotificationsHelper.Init(notificationsSettings); _lifecycleObserver = new AppLifecycleObserver(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(_lifecycleObserver); }
public void Include(ProcessLifecycleOwner processLifecycleOwner, ProcessLifecycleOwnerInitializer processLifecycleOwnerInitializer) { var proccessLifecycleOwner = ProcessLifecycleOwner.Get(); var initializer = new ProcessLifecycleOwnerInitializer(); }
public override void OnCreate() { base.OnCreate(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(this); }
private void FirstRunExcite() { try { //AppCenter.Start("9f8cf987-8bfc-4895-a18b-bd4a86ef9ae3", typeof(Analytics), typeof(Crashes)); AdsGoogle.InitializeAdsGoogle.Initialize(this); if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds) { InitializeFacebook.Initialize(this); } InitRtcEngine(); InitConfig(); switch (AppSettings.TurnSecurityProtocolType3072On) { //Bypass Web Errors //====================================== case true: { 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); break; } } switch (AppSettings.TurnTrustFailureOnWebException) { case true: { //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); break; } } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); //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); AXEmojiManager.Install(this, new AXIOSEmojiProvider(this)); Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver); if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { ApiRequest.GetTimeZoneAsync }); } var sqLiteDatabase = new SqLiteDatabase(); if (!string.IsNullOrEmpty(UserDetails.AccessToken)) { ListUtils.MuteList = sqLiteDatabase.Get_MuteList(); ListUtils.PinList = sqLiteDatabase.Get_PinList(); ListUtils.ArchiveList = sqLiteDatabase.Get_ArchiveList(); ListUtils.StickersList = sqLiteDatabase.Get_From_StickersTb(); if (AppSettings.LastChatSystem == SystemApiGetLastChat.New) { ListUtils.UserList = sqLiteDatabase.Get_LastUsersChat_List(); } else { ListUtils.UserChatList = sqLiteDatabase.GetLastUsersChatList(); } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show(); } }
private void FirstRunExcite() { try { if (AppSettings.ShowAdMobBanner || AppSettings.ShowAdMobInterstitial || AppSettings.ShowAdMobRewardVideo || AppSettings.ShowAdMobNative || AppSettings.ShowAdMobNativePost) { MobileAds.Initialize(this, GetString(Resource.String.admob_app_id)); } if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds) { InitializeFacebook.Initialize(this); } InitRtcEngine(); InitConfig(); //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(); //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); var sqLiteDatabase = new SqLiteDatabase(); if (AppSettings.LastChatSystem == SystemApiGetLastChat.New) { ListUtils.UserList = sqLiteDatabase.Get_LastUsersChat_List(); } else { ListUtils.UserChatList = sqLiteDatabase.GetLastUsersChatList(); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show(); } }
public AppLifeCycle() { Observer = new AndroidLifeCycleObserver(this); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(Observer); }