Code example for BluetoothAdapter

Methods: enableisEnabled

0
        /* mAdapter = (BluetoothAdapter) BluetoothAdapter.getDefaultAdapter(); 
        if (mAdapter == null) { 
            throw new RuntimeException("Platform does not support Bluetooth"); 
        } */ 
 
        if (mAdapter.isEnabled()) {
            Log.e(TAG,"BT is already enabled");
            Toast.makeText(context,"BT IS ALREADY ON ", Toast.LENGTH_LONG).show();
 
            Phone phone = PhoneFactory.getDefaultPhone();
            Log.e(TAG,"PhoneFactory.getDefaultPhone()  is  " + phone );
 
            BluetoothTestHelper earlyAck = new BluetoothTestHelper(context, phone);
            earlyAck.sendEarlyAck();
        } else { 
            Log.e(TAG,"Enabling BT ");
            mAdapter.enable();
        } 
    } 
 
    private synchronized void HostRequestBTOFF(Context context) {
        Log.e(TAG,"HostRequestBTOFF()");
Experience pair programming with AI  Get Codota for Java