private void StopBluetoothIfNotHasPermissions() { if ((LocationServicesPermissionUtils.DoesNotHavePermissions() || !_viewModel.GetAutoStartScanner()) && _viewModel.IsRunning) { _viewModel.StopBluetooth(); UnbindService(serviceConnection); } }
private void StartBluetoothIfHasPermissions() { if (!LocationServicesPermissionUtils.DoesNotHavePermissions() && !_viewModel.IsRunning && _viewModel.GetAutoStartScanner()) { if (LocationServicesPermissionUtils.AdapterState == State.On) { _viewModel.StartBluetooth(); } } }
private void HandleStartStop() { if (_viewModel.IsRunning) { _viewModel.StopBluetooth(); UnbindService(serviceConnection); } else { if (!LocationServicesPermissionUtils.DoesNotHavePermissions() && !_viewModel.IsRunning) { _viewModel.StartBluetooth(); BindDroidBluetoothService(); } } UpdateUI(); }