Q: Is it possible to automatically connect to Bluetooth LE device when it comes in range after pairing and and connected automatically to device? I am trying to connect UA-651 bp smart to mobile phone.but i am not able to autoconnect my app with device when it is in range?
i also tried below code bt it didn't work for me .plz give me solution for it
if (device == null) {
            Log.w(TAG, "Device not found.  Unable to connect.");
            return false;
        }
        // We want to directly connect to the device, so we are setting the
        // autoConnect parameter to false.
        // boolean: Whether to directly connect to the remote device (false) or
        // to automatically connect as soon as the remote device becomes
        // available (true).
        mBluetoothGatt = device.connectGatt(this, true, mGattCallback);
        Log.d(TAG, "Trying to create a new connection.");
        mBluetoothDeviceAddress = address;
        mConnectionState = STATE_CONNECTING;
        return true;
    }

