protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); ic = new InternetConnection(); prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); restService = new ServiceHelper(); geo = new Geolocation(); user = FindViewById <EditText>(Resource.Id.username); pass = FindViewById <EditText>(Resource.Id.pass); log = FindViewById <Button>(Resource.Id.login); log.Click += delegate { UserLogin(); }; main_method(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (Build.VERSION.PreviewSdkInt > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var webView = FindViewById <WebView>(Resource.Id.webView); webView.Settings.JavaScriptEnabled = true; // Use subclassed WebViewClient to intercept hybrid native calls webView.SetWebViewClient(new HybridWebViewClient()); // Render the view from the type generated from RazorView.cshtml var model = new Model1() { Text = "Text goes here" }; var template = new RazorView() { Model = model }; var page = template.GenerateString(); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); var wifi = (WifiManager)GetSystemService(WifiService); var ConnectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService); wifilock = wifi.CreateWifiLock(WifiMode.FullHighPerf, "WifiLock"); wifilock.Acquire(); game = new Game1( CreateUdpService(wifi, ConnectivityManager) , RuningOnAndroid: true ); if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { Vibrator vibrator = (Vibrator)GetSystemService(VibratorService); Game1.AndroidVibrate = f => vibrator.Vibrate(VibrationEffect.CreateOneShot(f, VibrationEffect.DefaultAmplitude)); } else { //TODO: } SetViewFullScreen(); //PowerManager pm = (PowerManager)GetSystemService(PowerService); //this.mWakeLock = pm.NewWakeLock(WakeLockFlags.ScreenDim, "My Tag"); //this.mWakeLock.Acquire(); game.Run(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); tabs = FindViewById <TabLayout>(Resource.Id.tabs); viewPager = FindViewById <ViewPager>(Resource.Id.viewpager); SetUpProductViewPager(viewPager); tabs.SetupWithViewPager(viewPager); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); }
//public static List<SubmitModel> summarydata = new List<SubmitModel>(); public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); im_model = new RecyclerAdapter <TaskInboxModel>(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); version = Android.App.Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Android.App.Application.Context.ApplicationContext.PackageName, 0).VersionName; base.OnCreate(savedInstanceState); }
private void Search(string search) { // Esto es para que me permita ejecutarlo sincrónicamente. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); var response = HttpHelper.Post <SearchProcessItemModel[]>($"api/svc/search?text={search}"); SetValues(response.ToDictionary(p => p.Id, p => p.Name)); }
// public static List<SubmitModel> summarydata = new List<SubmitModel>(); public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); im_model = new List <TaskOutboxModel>(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); geo = new Geolocation(); geolocation = geo.GetGeoLocation(Activity); base.OnCreate(savedInstanceState); }
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState, persistentState); // SetContentView(Resource.Layout.SplashScreen); Log.Debug(TAG, "SplashActivity.OnCreate"); }
public Communicator() { trustAllSslContext = SSLContext.GetInstance("SSL"); trustAllSslContext.Init(null, new ITrustManager[] { new CustomX509TrustManager() }, new SecureRandom()); client = new OkHttpClient(); client.SetConnectTimeout(5, Java.Util.Concurrent.TimeUnit.Seconds); client.SetSslSocketFactory(trustAllSslContext.SocketFactory); client.SetHostnameVerifier(new CustomHostNameVerifier()); client.SetProtocols(new Protocol[] { Protocol.Http11 }); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // GetPermissionAsync(); isRecording = false; SetContentView(Resource.Layout.compliance_layout2); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); AudioSavePathInDevice = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/AudioRecording.mp3"; geolocation = geo.GetGeoLocation(this); prefs = PreferenceManager.GetDefaultSharedPreferences(this); tap = geolocation.Split(","); //task_id = Intent.GetStringExtra("task_id") ?? string.Empty; //task_description = Intent.GetStringExtra("task_descrip") ?? string.Empty; //deadline = Intent.GetStringExtra("deadline") ?? string.Empty; //task_name = Intent.GetStringExtra("task_name") ?? string.Empty; //markby = Intent.GetStringExtra("mark_by") ?? string.Empty; //creationdate = Intent.GetStringExtra("creation_date") ?? string.Empty; //taskcreatedby = Intent.GetStringExtra("created_by") ?? string.Empty; camera = FindViewById <ImageButton>(Resource.Id.imageButton1); videobutton = FindViewById <ImageButton>(Resource.Id.imageButton2); location = FindViewById <ImageButton>(Resource.Id.imageButton4); mike = FindViewById <ImageButton>(Resource.Id.imageButton3); imagecaptured = FindViewById <ImageView>(Resource.Id.imageView1); description = FindViewById <EditText>(Resource.Id.ed2); rl2 = FindViewById <LinearLayout>(Resource.Id.rl2); rl3 = FindViewById <LinearLayout>(Resource.Id.rl3); rl4 = FindViewById <LinearLayout>(Resource.Id.rl4); mike.Click += delegate { recording(); }; location.Click += delegate { //CheckForLocation(); }; string path = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/test.mp4"; camera.Click += BtnCamera_Click; videobutton.Click += VideoClick; getData(); }
// Initialize communications, internal void InitComms() { if (socket == null) { // We wish to time how long this whole operation takes. stopwatch = System.Diagnostics.Stopwatch.StartNew(); // Allow networking on the main thread. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); socket = new CommSocket(); socket.ConnectToServer(); } }
// ExpandableListView mainList; //string[] Noticeitems; //RecyclerView mRecycleView; //RecyclerView.LayoutManager mLayoutManager; //PhotoAlbum mPhotoAlbum; //HomeSlider_Adapter mAdapter; public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); Activity.OverridePendingTransition(Resource.Animation.slide_up1, Resource.Animation.hold); // Create your fragment here }
protected override void OnCreate(Bundle bundle) { var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); ToolbarResource = Resource.Layout.toolbar; TabLayoutResource = Resource.Layout.tabs; base.OnCreate(bundle); // workaround for app compat bug // ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity Task.Delay(10).Wait(); Console.WriteLine("A OnCreate"); Window.SetSoftInputMode(SoftInput.StateHidden); Window.AddFlags(WindowManagerFlags.Secure); var appIdService = Resolver.Resolve <IAppIdService>(); var authService = Resolver.Resolve <IAuthService>(); HockeyApp.Android.CrashManager.Register(this, HockeyAppId, new HockeyAppCrashManagerListener(appIdService, authService)); Forms.Init(this, bundle); typeof(Color).GetProperty("Accent", BindingFlags.Public | BindingFlags.Static) .SetValue(null, Color.FromHex("d2d6de")); LoadApplication(new App.App( Resolver.Resolve <IAuthService>(), Resolver.Resolve <IConnectivity>(), Resolver.Resolve <IUserDialogs>(), Resolver.Resolve <IDatabaseService>(), Resolver.Resolve <ISyncService>(), Resolver.Resolve <IFingerprint>(), Resolver.Resolve <ISettings>(), Resolver.Resolve <ILockService>(), Resolver.Resolve <IGoogleAnalyticsService>(), Resolver.Resolve <ILocalizeService>())); MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "RateApp", (sender) => { RateApp(); }); }
protected override void OnCreate(Bundle savedInstanceState) { ListRadio aListRadio = new ListRadio(Intent.GetStringExtra(Category)); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DefaultListViewer); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); // Getting Country wise Channel List ListView myListView = FindViewById <ListView>(Resource.Id.DefaultListView); RadioChannelLst = aListRadio.GetCountryWiseRadio(); myListView.Adapter = GetAdapter(); myListView.ItemClick += MyListView_ItemClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); ActionBar.Hide(); IP_ADDR = (Intent.GetStringExtra("IPAddress") == "" ? "192.168.100.7" : Intent.GetStringExtra("IPAddress")); deviceWidth = 320; // Resources.DisplayMetrics.WidthPixels; deviceHeight = 240; // Resources.DisplayMetrics.HeightPixels; StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); InitializeCameraView(); InitializeControls(); InitializeSocket(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); dba = new DBHelper(); service = new ServiceHelper(); con = new InternetConnection(); geo = new Geolocation(); ic = new BlobFileUpload(this); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); View header = navigationView.GetHeaderView(0); string userName = prefs.GetString("UserName", ""); string number = prefs.GetString("MobileNumber", ""); TextView name1 = (TextView)header.FindViewById(Resource.Id.nameInst); TextView mobile1 = (TextView)header.FindViewById(Resource.Id.numberInst); name1.Text = userName; mobile1.Text = number; DisplayLocationSettingsRequest(); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.container, new GSTNVerification()).Commit(); }
// This Function will call when application will loaded protected override void OnCreate(Bundle savedInstanceState) { ListRadio aListRadio = new ListRadio(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); // Get Country category to load on landing page MenuLst = aListRadio.GetAllCountry(); myListView = FindViewById <ListView>(Resource.Id.DefaultMenuListView); // Fill listview throw Adapter myListView.Adapter = GetAdapter(); // Added Event on Country click myListView.ItemClick += MyListView_ItemClick; }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); restService = new ServiceHelper(); geo = new Geolocation(); db = new DbHelper(); ic = new InternetConnection(); blob = new BlobFileUpload(); geolocation = geo.GetGeoLocation(Activity); tap = geolocation.Split(','); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); isRecording = false; }
private void Mylock(DevicePolicyManager policyManager, ComponentName componentName) { if (Build.VERSION.SdkInt > BuildVersionCodes.Froyo) { var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); } var active = policyManager.IsAdminActive(componentName); if (!active) { // Without permission Log.Error(logTag, "No authority~"); ActiveManage(componentName); // To get access } else { Log.Error(logTag, "Has authority"); } policyManager.LockNow(); // lock screen directly Finish(); }
protected void InitStrictMode() { var builder = new StrictMode.ThreadPolicy.Builder() .DetectCustomSlowCalls() .DetectNetwork() .PenaltyLog(); if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { builder = builder.DetectResourceMismatches(); } StrictMode.SetThreadPolicy(builder.Build()); StrictMode.SetVmPolicy( new StrictMode.VmPolicy.Builder() .DetectActivityLeaks() .DetectLeakedClosableObjects() .PenaltyLog() .Build()); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); geo = new Geolocation(); ic = new InternetConnection(); restService = new ServiceHelper(); version = Android.App.Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Android.App.Application.Context.ApplicationContext.PackageName, 0).VersionName; geolocation = geo.GetGeoLocation(Activity); //if (permissionmethodAsync() == true) //{ //} //else //{ // permissionmethodAsync(); //} }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); restService = new ServiceHelper(); geo = new Geolocation(); db = new DbHelper(); ic = new InternetConnection(); //comp_AttachmentModels = new List<Comp_AttachmentModel>(); blob = new BlobFileUpload(); datacomp = new List <ComplianceModel>(); taskuploaded = new List <Comp_AttachmentModel>(); task_id_to_send = Arguments.GetString("task_id") ?? string.Empty; geolocation = geo.GetGeoLocation(Activity); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); //isRecording = false; }
protected override void OnCreate(Bundle savedInstanceState) { Button btnConnect; base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); if (Android.OS.Build.VERSION.SdkInt > BuildVersionCodes.Lollipop) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); } txtCopyRight = (TextView)FindViewById(Resource.Id.textView2Copyright); btnConnect = (Button)FindViewById(Resource.Id.ButtonConnect); btnConnect.Click += (s, e) => { Intent i = new Intent(this, typeof(Login)); StartActivity(i); }; txtCopyRight.Click += TxtCopyRight_Click; }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); progress = new Android.App.ProgressDialog(Activity); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please Wait..."); pref = Android.App.Application.Context.GetSharedPreferences("AboutExamInfo", FileCreationMode.Private); Abour_Exam = pref.GetString("FinalAboutExam", "false"); dba = new DBHelper(); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); image_list = new List <TaskFileMapping_Model>(); audio_list = new List <TaskFileMapping_Model>(); video_list = new List <TaskFileMapping_Model>(); listmapping = new List <TaskFileMapping_Model>(); modelsaddcompliance = new List <ComplianceJoinTable>(); licenceidmodel = new List <CreateTaskLicenceIdReturnModel>(); lstcomplinace = new List <ComplianceJoinTable>(); restService = new ServiceHelper(); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); DesignationId = prefs.GetString("DesignationId", ""); geo = new Geolocation(); // db = new DbHelper(); ic = new InternetConnection(); base.OnCreate(savedInstanceState); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); restService = new ServiceHelper(); geo = new Geolocation(); db = new DbHelper(); ic = new InternetConnection(); initialTasks = new List <InitialTaskModel>(); initialtaskservicelist = new List <InitialTaskModel>(); taskidmodel = new List <CreateTaskLicenceIdReturnModel>(); dbtasklist = new List <InitialTaskModel>(); blob = new BlobFileUpload(); con = new InternetConnection(); geolocation = geo.GetGeoLocation(Activity); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); designationid = prefs.GetString("DesignationId", ""); taskidmodel = CreateTaskFrag.licenceidmodel; }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); BackgroundAggregator.Init(this); string filename = "weather_db.sqlite"; string filelocation = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string full_path = Path.Combine(filelocation, filename); string settings_path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "settings_db.sqlite"); string lgw_path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "lgweather_db.sqlite"); string fw_path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "fweather_db.sqlite"); Forms.Init(this, savedInstanceState); LoadApplication(new App(full_path, settings_path, lgw_path, fw_path)); AiForms.Renderers.Droid.SettingsViewInit.Init(); // need to write here startrunservice(); }
protected override void OnCreate(Bundle savedInstanceState) { var eventUploadIntent = new Intent(this, typeof(EventUploadReceiver)); _eventUploadPendingIntent = PendingIntent.GetBroadcast(this, 0, eventUploadIntent, PendingIntentFlags.UpdateCurrent); var alarmIntent = new Intent(this, typeof(LockAlarmReceiver)); _lockAlarmPendingIntent = PendingIntent.GetBroadcast(this, 0, alarmIntent, PendingIntentFlags.UpdateCurrent); var clearClipboardIntent = new Intent(this, typeof(ClearClipboardAlarmReceiver)); _clearClipboardPendingIntent = PendingIntent.GetBroadcast(this, 0, clearClipboardIntent, PendingIntentFlags.UpdateCurrent); var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _broadcasterService = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _appIdService = ServiceContainer.Resolve <IAppIdService>("appIdService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _eventService = ServiceContainer.Resolve <IEventService>("eventService"); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; UpdateTheme(ThemeManager.GetTheme(true)); base.OnCreate(savedInstanceState); if (!CoreHelpers.InDebugMode()) { Window.AddFlags(Android.Views.WindowManagerFlags.Secure); } #if !FDROID var hockeyAppListener = new HockeyAppCrashManagerListener(_appIdService, _userService); var hockeyAppTask = hockeyAppListener.InitAsync(this); #endif Xamarin.Essentials.Platform.Init(this, savedInstanceState); Xamarin.Forms.Forms.Init(this, savedInstanceState); _appOptions = GetOptions(); LoadApplication(new App.App(_appOptions)); _broadcasterService.Subscribe(_activityKey, (message) => { if (message.Command == "scheduleLockTimer") { var alarmManager = GetSystemService(AlarmService) as AlarmManager; var lockOptionMinutes = (int)message.Data; var lockOptionMs = lockOptionMinutes * 60000; var triggerMs = Java.Lang.JavaSystem.CurrentTimeMillis() + lockOptionMs + 10; alarmManager.Set(AlarmType.RtcWakeup, triggerMs, _lockAlarmPendingIntent); } else if (message.Command == "cancelLockTimer") { var alarmManager = GetSystemService(AlarmService) as AlarmManager; alarmManager.Cancel(_lockAlarmPendingIntent); } else if (message.Command == "startEventTimer") { StartEventAlarm(); } else if (message.Command == "stopEventTimer") { var task = StopEventAlarmAsync(); } else if (message.Command == "finishMainActivity") { Xamarin.Forms.Device.BeginInvokeOnMainThread(() => Finish()); } else if (message.Command == "listenYubiKeyOTP") { ListenYubiKey((bool)message.Data); } else if (message.Command == "updatedTheme") { RestartApp(); } else if (message.Command == "exit") { ExitApp(); } else if (message.Command == "copiedToClipboard") { var task = ClearClipboardAlarmAsync(message.Data as Tuple <string, int?, bool>); } }); }