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

On API level >=26 use companion device pairing rather than the old BLE pairing API #14

Closed
Dafeman opened this issue Apr 12, 2020 · 6 comments · Fixed by #341
Closed
Labels
enhancement New feature or request

Comments

@Dafeman
Copy link

Dafeman commented Apr 12, 2020

If location services are turned off then no devices are shown and you cannot pair. In older app versions I think there was a warning about needing both turned on but not in recent releases. If possible it would be good not to require location services for boards that are equipped with GPS already.

@geeksville
Copy link
Member

geeksville commented Apr 12, 2020 via email

@geeksville
Copy link
Member

geeksville commented Apr 13, 2020 via email

@Dafeman
Copy link
Author

Dafeman commented Apr 13, 2020

Ah right, seems overboard to require location be turned on just so the user is now aware that their location may be known when using BT! This may be useful for newer devices as it doesn't require location permissions. https://developer.android.com/guide/topics/connectivity/companion-device-pairing
Disclaimer - I have no programming experience, just google search experience!

@geeksville
Copy link
Member

oh! that's great! Thanks for the link - I hadn't heard they added that. I'll repurpose this bug:

On devices running Android 8.0 (API level 26) and higher, companion device pairing performs a Bluetooth or Wi-Fi scan of nearby devices on behalf of your app without requiring the ACCESS_FINE_LOCATION or BLUETOOTH_ADMIN permission. This helps minimize the number of permissions needed by your app and is more privacy-friendly for users. After the device is paired, the device can leverage the REQUEST_COMPANION_RUN_IN_BACKGROUND and REQUEST_COMPANION_USE_DATA_IN_BACKGROUND permissions to start the app from the background. You might use this method of pairing devices for initial configuration of a BLE-capable smart watch, for example.

Companion device pairing doesn't create the connection to chosen devices. You use Bluetooth or Wi-Fi connectivity APIs to establish connections. Companion device pairing also isn't intended for continuous scanning. It is a means for implementing custom protocols over Bluetooth, BLE, and Wi-Fi that are required for the companion device to function.

The requested permissions are granted when the user associates your app by selecting a device from the list. These permissions are revoked only if you call disassociate() or if the app is uninstalled. An app is responsible for clearing its own associations if the user no longer needs them, such as when they log out or remove bonded devices.

@geeksville geeksville changed the title In app pairing doesn't work without location services on. On API level >=26 use companion device pairing rather than the old BLE pairing API Apr 13, 2020
@geeksville geeksville added the enhancement New feature or request label Apr 13, 2020
@geeksville geeksville added this to To do in Meshtastic work via automation Apr 13, 2020
@geeksville geeksville moved this from To do to After1.0 in Meshtastic work Apr 13, 2020
@Dafeman
Copy link
Author

Dafeman commented Apr 13, 2020

Awesome, love your work!

@geeksville geeksville self-assigned this Apr 18, 2020
@geeksville geeksville moved this from After1.0 to In progress in Meshtastic work Apr 18, 2020
geeksville added a commit to geeksville/Meshtastic-Android that referenced this issue Apr 19, 2020
geeksville added a commit to geeksville/Meshtastic-Android that referenced this issue Apr 19, 2020
geeksville added a commit to geeksville/Meshtastic-Android that referenced this issue Apr 19, 2020
@geeksville geeksville removed their assignment Apr 26, 2020
@geeksville geeksville moved this from In progress to After1.0 in Meshtastic work Jun 12, 2020
@geeksville
Copy link
Member

This issue has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/how-do-i-stop-the-android-app-properly/941/9

@andrekir andrekir linked a pull request Jan 9, 2022 that will close this issue
@andrekir andrekir moved this from Not Soon to In progress in Meshtastic work Jan 9, 2022
Meshtastic work automation moved this from In progress to Done Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants