protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; _logService = new LogService(); _receiver = new AutoStart(); base.OnCreate(savedInstanceState); CrossCurrentActivity.Current.Activity = this; Forms.Init(this, savedInstanceState); LoadApplication(new App()); RequestPermissions(new[] { Manifest.Permission.AccessFineLocation, Manifest.Permission.BluetoothPrivileged }, 0); GetMcaNotificationService(); _mcaNotificationService.SendNotification("AndroidBeacon", "APP STARTED"); _logService.WriteToLog(LogFilename, "APP STARTED"); if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O) { StartForegroundService(new Intent(this, typeof(AppService))); } else { StartService(new Intent(this, typeof(AppService))); } }
protected override void OnResume() { base.OnResume(); _receiver = new AutoStart(); RegisterReceiver(_receiver, new IntentFilter("android.intent.action.BOOT_COMPLETED")); }