Code example for BluetoothAdapter

Methods: getScanMode

0
        } 
    } 
     
    private void ensureDiscoverable() { 
        Logger.d("ensure discoverable"); 
        if (mBluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
            Intent discoverableIntent = new Intent(
                    BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
            discoverableIntent.putExtra(
                    BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
            startActivity(discoverableIntent);
        } 
    } 
     
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        Logger.d("onActivityResult " + resultCode);
        if(requestCode == REQUEST_ENABLE_BT){
            // When the request to enable Bluetooth returns 
            if (resultCode == Activity.RESULT_OK) {
                // Bluetooth is now enabled, so set up a chat session 
                setupConroler();