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

Not connecting with the same device again. #57

Open
nomanhamid opened this issue Oct 25, 2021 · 9 comments
Open

Not connecting with the same device again. #57

nomanhamid opened this issue Oct 25, 2021 · 9 comments

Comments

@nomanhamid
Copy link

Scanning goes perfect every time

After scanning, if I want to connect with a specific device then it does nothing... Literally nothing, even my device is not null and goes to the connect/Reconnect fucntion.

@philips77
Copy link
Member

Sorry, but I don't understand. What exactly do you have issue with?

@alosantmobileapps
Copy link

Hello @philips77 - The issue above is we get intermittent connections to the BLE device. Sometimes it pairs right away, other times it just scans and scans. We have tested various time periods of waiting between trying establish connection again, no change in intermittent performance. The device seems to just pair sometimes, rarely consecutively but sometimes 2 times in a row, never 3 times in the row. Signal strength is good and pairs immediately every time on ios. We can't seem to figure out what is causing the pairing to be successful, or what is causing the scanning to just continue and never pair. On rNF Connect, when I hit "Connect" to the device on Android it immediately connects, every time. Any help would be greatly appreciated! Thank you!

@philips77
Copy link
Member

Sometimes it pairs right away, other times it just scans and scans.

By pairs you mean connects, or shows up in Scanner results?

We have tested various time periods of waiting between trying establish connection again, no change in intermittent performance.

Are you sure the device is disconnected after the first connection? Which version of the app are you using? 2.6.0?

It may be, that your device does not disconnect when you leave the 2nd screen. Either it is still connected by some leaked view model (update to 2.6.0 to have it fixed, I hope), or by some other app in background (e.g. nRF Connect on pre-Oreo versions).
Try resetting your device and see whether you can connect immediately.

@philips77
Copy link
Member

What phone and Android version are you testing with? Did you try another phone?

@nomanhamid
Copy link
Author

Screenshot 2021-11-05 015813

SDK is for sure the latest one and also the connection request being used.
Every time try to connect with the peripheral, it comes into case DISCONNECTED:.
On contrary, it is working fine in iOS build.

Attached is the screenshot that clearly show the state evaluation.

@alosantmobileapps
Copy link

alosantmobileapps commented Nov 4, 2021

Hello @philips77 -

Yes, we tried S8+ and S10, both exhibiting same issues. Both running latest Android version 9.

By pairs you mean connects, or shows up in Scanner results?

It does not connect but shows scanner results.

We are seeing error: REASON_NOT_SUPPORTED

Which prompts device to run disconnect immediately after.

This response: REASON_NOT_SUPPORTED may be the root of our issue.

Screen shot attached:

image

@nomanhamid and I are working together on this, thus the two posts.

We have tried restarting device and killing nRF app and these do not change symptoms.

Any help would be so appreciated!

Thank you
Mike

@alosantmobileapps
Copy link

Hey @philips77 - Not sure if you saw this update. Any help would be greatly appreciated as we are stuck with this error and do not understand what it means.

Thank you
Mike

@philips77
Copy link
Member

This response: REASON_NOT_SUPPORTED may be the root of our issue.

This error is thrown when the LBS Service isn't found in the device, at least in Blinky sample app. If you've modified the app and have changed the UUID in the manager, make sure your devices actually have required service. You may use nRF Connect for Android, discover services and check. You may also try to Refresh services in top right menu.

@philips77
Copy link
Member

philips77 commented Nov 9, 2021

Examine

public boolean isRequiredServiceSupported(@NonNull final BluetoothGatt gatt) {
final BluetoothGattService service = gatt.getService(LBS_UUID_SERVICE);
if (service != null) {
buttonCharacteristic = service.getCharacteristic(LBS_UUID_BUTTON_CHAR);
ledCharacteristic = service.getCharacteristic(LBS_UUID_LED_CHAR);
}
boolean writeRequest = false;
if (ledCharacteristic != null) {
final int ledProperties = ledCharacteristic.getProperties();
writeRequest = (ledProperties & BluetoothGattCharacteristic.PROPERTY_WRITE) > 0;
}
supported = buttonCharacteristic != null && ledCharacteristic != null && writeRequest;
return supported;
}
method and compare services that you check vs those in the BluetoothGatt object.

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

3 participants