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

Combination with background-geolocation: No disconnect when app gets closed #158

Open
pentabarf opened this issue Aug 9, 2021 · 5 comments
Labels
bug Something isn't working cannot reproduce

Comments

@pentabarf
Copy link

Description
Using this Plugin together with capacitor-community/background-geolocation in Android: bluetooth connection doesn't get closed when app is closed.

Reproduce

  1. Create an ionic app for Android
  2. install background-geolocation
  3. install cordova-plugin-ble-central or capacitor-community/bluetooth-le
  4. connect a ble device with the app
  5. close the app
  6. device is still connected with phone and therefore doesn't get find when reopen the app
  7. to verify: disable Bluetooth in phone settings after app is closed and the device will notify a disconnect

Expected behavior
Bluetooth connection should get closed when app gets closed

Smartphone

  • Device: Motorola moto g 5G plus, Google Pixel 2
  • OS: Android 10
  • Version 29

Additional context
I am working on a ble-sensor combined with geolocation tracker project

I opened this also as an issue at capacitor-community/background-geolocation:
capacitor-community/background-geolocation#32

@pwespi
Copy link
Member

pwespi commented Aug 21, 2021

Unfortunately I wasn't able to reproduce your behavior.

However, in the newest release 1.2.0 there is a new method getConnectedDevices which might be useful for your situation. With this method you should be able to get the connected device without the need for scanning.

Does this solve your problem?

@pentabarf
Copy link
Author

Thanks for the advice with getConnectedDevices. After restarting the app I was able to get a list containing the device but i am not able to disconnect from it.

@pwespi
Copy link
Member

pwespi commented Sep 6, 2021

Did you connect to the device from the app? If you connect from another app or the OS settings, the app is not allowed to disconnect?

@pentabarf
Copy link
Author

I connect from an earlier instance of the app. As i wrote: the device doesn't get disconnect when killing the app whyever because of background-geolocation.

@HyperLife1119
Copy link

Thanks for the advice with getConnectedDevices. After restarting the app I was able to get a list containing the device but i am not able to disconnect from it.

I have the same problem, it can be reproduced on android 12, but not on android 14.

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

No branches or pull requests

3 participants