@Override
    protected void onResume() {
        super.onResume();
        IntentReceiverCompat.registerExportedReceiver(
                this,
                mGattUpdateReceiver,
                makeGattUpdateIntentFilter()
        );

        if (mBluetoothLeService != null) {
            final boolean result = mBluetoothLeService.connect(mDevice.getAddress());
            Log.d(TAG, "Connect request result=" + result);
        }
    }
For a given BLE device, this Activity provides the user interface to connect, display data,
and display GATT services and characteristics supported by the device.  The Activity
communicates with {@code BluetoothLeService}, which in turn interacts with the
Bluetooth LE API.
sample_app/src/main/java/uk/co/alt236/btlescan/ui/control/DeviceControlActivity.java