Code example for BluetoothAdapter

Methods: getScanModeisEnabled

        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
            if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) { 
                Log.d(TAG, "BT Action State Changed!"); 
                if (mBluetoothAdapter.isEnabled()) { 
                    Log.d(TAG, "BT Enabled"); 
                    Log.d(TAG, "Checking BT Discoverable"); 
                    if (mBluetoothAdapter.getScanMode() == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) { 
                        Log.d(TAG, "BT Discoverable"); 
                    else { 
                        Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); 
                        discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 120); 
                        Log.d(TAG, "BT is NOT Discoverable yet"); 
Connect your IDE to all the code out there  Get Codota for Java