Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startDiscovery impossible #56

Open
openmotion opened this issue Aug 20, 2020 · 7 comments
Open

startDiscovery impossible #56

openmotion opened this issue Aug 20, 2020 · 7 comments

Comments

@openmotion
Copy link

openmotion commented Aug 20, 2020

Hello

i try to use your library with a simple code
bluetooth = new Bluetooth(this);

    bluetooth.setBluetoothCallback(bluetoothCallback);
    bluetooth.setDiscoveryCallback(discoveryCallback);

    if(bluetooth != null) {
        try {
            bluetooth.startScanning();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

but i have this error

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothAdapter.startDiscovery()' on a null object reference

@omaraflak
Copy link
Owner

It's because you haven't called bluetooth.onStart(). Take a look at the README.

@openmotion
Copy link
Author

hello it's ok but now i have this error when i try to connect : Could not connect, next try in 3 sec... : read failed, socket might closed or timeout, read ret: -1
i have the same error in your demo app :p

@omaraflak
Copy link
Owner

Is the device you are trying to connect to a BLE device ?

@openmotion
Copy link
Author

Is the device you are trying to connect to a BLE device ?

Yes it's possible
I can connect to the device with the default tchat app from Google. I am searching for a library able to manage jpg file transfer

@openmotion
Copy link
Author

Is the device you are trying to connect to a BLE device ?

Yes it's possible
I can connect to the device with the default tchat app from Google. I am searching for a library able to manage jpg file transfer

The device must be BLE compatible yes but i don't want to connect it in BLE

@omaraflak
Copy link
Owner

The library does not support BLE.
Of you run the app in the repo does it connect without problem ?
Socket timeout might happen few times before connecting successfully..

@openmotion
Copy link
Author

The library does not support BLE.
Of you run the app in the repo does it connect without problem ?
Socket timeout might happen few times before connecting successfully..

the app in the repo does not connect :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants