mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
Add BlueTooth receivers in onResume
Pairing some devices requires a PIN to be entered. E.g. the flow is: confirm you'd like to pair, pass off to Android which prompts for a PIN to pair with (typically shows up on the non-phone device's screen or is hard coded in the manual), then return back to the app. When this pairing request screen pops up, it takes focus. This invokes onPause and onStop in the DiscoveryActivity, which removes the BlueTooth broadcast receivers. Returning focus (after successful pairing), there's nothing to listen to the event. Practically speaking, GadgetBridge last saw the device as BOND_BONDING, so it's out of sync. If queried, the device is BOND_BONDED, so it's good to move on to the next step. Many existing pairing activities (Lenovo, MiBand, Pebble, Watch9) have an implementation of onResume() to presumably tackle this issue, this adds it to `DiscoveryActivity` as well. Testing with some other supporting code, this allows a Garmin vivosport to appear in Gadgetbridge.
This commit is contained in:
parent
5a9d1e23f5
commit
ab306b1352
@ -338,6 +338,12 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
removeBroadcastReceivers();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
private void stopAllDiscovery() {
|
||||
try {
|
||||
stopBTDiscovery();
|
||||
|
Loading…
Reference in New Issue
Block a user