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

Android: failing to connect when native pair modal not pressed in time #611

Open
simonvnk opened this issue Jan 8, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@simonvnk
Copy link

simonvnk commented Jan 8, 2024

Describe the bug
Whenever I call the BleClient.Connect function, this will trigger a native modal on an android device where you need to press 'pair' or 'deny'. Whenever the user takes too long to press pair, the connect method will trigger its disconnected function and the rest of my flow fails. This is not what I expect, shouldn't the connect method have some type of waiting mechanism for this modal?

To Reproduce

  1. Call BleClient.connect()
  2. Wait a couple of seconds
  3. Press pair

Expected behavior
I expect to succeed the connection, even when pair is not pressed inmediately

Plugin version:

  • @capacitor-community/bluetooth-le: 3.1.0

Desktop (please complete the following information):

  • OS: Android

Smartphone (please complete the following information):

  • Device: One plus 10pro
  • OS: Android version 14
@simonvnk simonvnk added the bug Something isn't working label Jan 8, 2024
@pwespi
Copy link
Member

pwespi commented Jan 8, 2024

You are right, currently the connect call does not wait for the pairing process.

As a workaround you can set the timeout of the connect call to something longer than the default (10000 ms).

@crebuh
Copy link

crebuh commented Feb 13, 2024

@pwespi tried the workaround but the promise directly resolves when the connection is established, so the pairing dialog always occurs afterwards. any other idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants