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 8 support #3

Open
guillaumelachaud opened this issue Jan 2, 2018 · 8 comments
Open

Android 8 support #3

guillaumelachaud opened this issue Jan 2, 2018 · 8 comments

Comments

@guillaumelachaud
Copy link

guillaumelachaud commented Jan 2, 2018

I am trying to use the library to broadcast a Beacon from my Google Pixel XL running Android 8.1. I am facing two issues:

  • My sample app was initially targeting SDK 26. Because of the use of Services and Broadcast Receivers that haven't been ported to support the new Oreo, the notification that a beacon is broadcasting wasn't showing up. Targeting SDK 25 in my sample app helped solving this issue.
  • Even after that, I couldn't get my Samsung Galaxy S8, running Android 7 to detect my beacon. Listening to events on the Pixel XL, I receive EVENT_ADVERTISER_ADDED followed by a EVENT_ADVERTISER_STARTED and that's it, nothing to indicate an error. Logcat has a few BLE related errors that might be relevant. Note that if I run my sample app on the Galaxy S8, then my Pixel can successfully detect the beacon. I tried to reproduce on another S8 and had same results, indicating the issue seems to be with the Pixel XL.

Logcat excerpt:

01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0100
01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0100
01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=6 connected=0 conn_id=6 reason=0x0100
01-02 11:10:00.183 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=7 connected=0 conn_id=7 reason=0x0100
01-02 11:10:00.183 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=8 connected=0 conn_id=8 reason=0x0100
01-02 11:10:00.185 2153-2673/? D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=E0:49:D9:C3:F7:C9
01-02 11:10:00.187 7708-7720/? D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=E0:49:D9:C3:F7:C9
01-02 11:10:00.204 7708-7852/? D/BluetoothGatt: cancelOpen() - device: E0:49:D9:C3:F7:C9
01-02 11:10:00.207 1326-1794/? E/bt_btif: No such connection need to be cancelled
01-02 11:10:00.208 1326-1794/? E/bt_stack: [ERROR:bta_gattc_utils.cc(509)] bta_gattc_mark_bg_conn unable to find the bg connection mask for: e0:49:d9:c3:f7:c9
01-02 11:10:00.218 7708-7852/? D/BluetoothGatt: close()
01-02 11:10:00.218 7708-7852/? D/BluetoothGatt: unregisterApp() - mClientIf=8
01-02 11:10:00.219 7708-7961/? D/BluetoothGatt: connect() - device: D6:11:68:96:F7:7D, auto: false
01-02 11:10:00.219 7708-7961/? D/BluetoothGatt: registerApp()
01-02 11:10:00.220 7708-7961/? D/BluetoothGatt: registerApp() - UUID=8441d0b4-251f-4c79-b1f0-7a5cd3306cc6
01-02 11:10:00.224 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1004)] GATT_Register
01-02 11:10:00.225 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1027)] allocated gatt_if=8
01-02 11:10:00.231 7708-7720/? D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
01-02 11:10:00.236 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1168)] GATT_Connectgatt_if=8 d6:11:68:96:f7:7d
01-02 11:10:01.951 887-1560/? I/WifiService: releaseMulticastLock uid=10156
01-02 11:10:02.525 7708-7708/? D/BluetoothManager: getConnectedDevices
01-02 11:10:02.531 2519-2519/? I/BgTaskExecutorImpl: Starting EXCLUSIVE background task send_pending_events_to_clearcut.
01-02 11:10:02.554 2519-2519/? W/SearchService: Abort, client detached.
01-02 11:10:02.555 2519-11929/? I/EventLogSendingHelper: Sending log events.
01-02 11:10:02.590 2153-5407/? I/Places: ?: PlacesBleScanner stop()
01-02 11:10:02.591 2153-2153/? I/BeaconBle: Places requested to stop scan
01-02 11:10:02.597 2153-2153/? I/BeaconBle: Scan canceled successfully.
01-02 11:10:02.606 2153-5407/? I/PlaceInferenceEngine: [anon] Changed inference mode: 105
01-02 11:10:04.564 887-2347/? I/ActivityManager: Killing 9150:com.facebook.katana/u0a296 (adj 906): empty #17```
@adriancretu
Copy link
Owner

The library is not yet updated to allow the notification for the service on 8.0. So, even though you get back the relevant events there is no actual BLE transmission started. Interesting. Does Beacon Toy behave the same when trying to start a beacon?

@guillaumelachaud
Copy link
Author

I just tried Beacon Toy and yes, it does behave the same. Note that I also tried Beacon Simulator (https://play.google.com/store/apps/details?id=net.alea.beaconsimulator) and had the same results.

@adriancretu
Copy link
Owner

Are you sure the S8 can detect other beacons? The only API updates in Oreo relate to Bluetooth 5.0 support for extended advertising (up to 251 bytes using data channel multiplexing).

@guillaumelachaud
Copy link
Author

guillaumelachaud commented Jan 3, 2018 via email

@guillaumelachaud
Copy link
Author

guillaumelachaud commented Jan 3, 2018 via email

@adriancretu
Copy link
Owner

That logcat is suspiciously referencing BLE GATT connections. Usually a BLE chip will not advertise while there is an active GATT connection in progress. Do you have accessories that are connecting to your Pixel somehow?

@guillaumelachaud
Copy link
Author

guillaumelachaud commented Jan 3, 2018 via email

@adriancretu
Copy link
Owner

AOSP Oreo 8.1r1 on a Nexus 6 behaves as expected, beacons can be created and even the service works correctly, waking up at the correct time in case of refreshable beacons such as EID.

I'll release shortly a new library version that compiles against the latest SDK, so that the notification works without the app crashing when targeting API 26 or later. But that doesn't fix your issue, which is likely an app on the Pixel that is interfering with the BLE stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants