protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Forms.Init(this, savedInstanceState); SimpleLocationManager.SetContext(this); SimpleLocationManager.HowOftenShowUseLocationDialog = SimpleLocationManager.ShowUseLocationDialog.Once; SimpleLocationManager.HandleLocationPermission = true; SimpleLocationManager.ShouldShowRequestPermissionRationale = true; app = new App(); BackgroundLocationService.App = app; app.startButton.Clicked += delegate { StartService(new Intent(this, typeof(BackgroundLocationService))); }; app.stopButton.Clicked += delegate { StopService(new Intent(this, typeof(BackgroundLocationService))); }; app.SimpleLocationManager.ShowRequestPermissionRationale += delegate { ShowRequestPermissionRationale(); }; LoadApplication(app); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Forms.Init(this, savedInstanceState); FormsMaterial.Init(this, savedInstanceState); SimpleLocationManager.SetContext(this); SimpleLocationManager.HowOftenShowUseLocationDialog = SimpleLocationManager.ShowUseLocationDialog.Once; SimpleLocationManager.HandleLocationPermission = true; SimpleLocationManager.ShouldShowRequestPermissionRationale = true; app = new App(); app.SimpleLocationManager.LocationUpdatesStarted += () => StartService(new Intent(this, typeof(BackgroundLocationService))); app.SimpleLocationManager.LocationUpdatesStopped += () => StopService(new Intent(this, typeof(BackgroundLocationService))); app.SimpleLocationManager.ShowRequestPermissionRationale += () => ShowRequestPermissionRationale(); BackgroundLocationService.SimpleLocationManager = app.SimpleLocationManager; LoadApplication(app); }