BLE Scan works only when APP in foreground.

Nick.PNick.P GBMember ✭✭

Our Android application connects to our nRF52 (BLE) within 2..3 seconds while the APP in foreground. The Advertisement is picked during a periodic scan performed by a dedicated service.
When the APP is in background, although the scan is performed (proved by breakpoint, and an incrementing counter), there are no scan results.
As soon as the APP is bough into foreground, the scan picks the device normally.
Both the Android API StartScan() and the deprecated StartLeScan() have exactly the same behaviour.
What is required to make the scan work in the background ?

Best Answers

Answers

  • AlbertKAlbertK MYMember ✭✭✭✭

    hi,

    You might want to try the Plugin-BLE, It takes care of most the plumbing for you and it works pretty well. The is a compile version in Nuget.

    https://github.com/xabre/xamarin-bluetooth-le

  • Nick.PNick.P GBMember ✭✭

    Thanks, this is interesting. However a brief search reveals that this plug-in has the same issue as me, using the raw native.
    https://github.com/xabre/xamarin-bluetooth-le/issues/57

  • IlyaPonomarevIlyaPonomarev USMember ✭✭
    edited October 2017

    Hi. Could you please show your implementation? Got the same problem with scan in background.

Sign In or Register to comment.