private void open() { if (hrProvider != null && !hrProvider.isEnabled()) { if (hrProvider.startEnableIntent(this, 0) == true) { return; } hrProvider = null; } if (hrProvider != null) { log(hrProvider.getProviderName() + ".open(this)"); hrProvider.open(handler, this); } else { updateView(); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 0) { if (!hrProvider.isEnabled()) { log("Bluetooth not enabled!"); scanButton.setEnabled(false); connectButton.setEnabled(false); return; } load(); open(); return; } if (requestCode == 123) { startScan(); return; } }