-1

I have an access system based on BLE controllers and a cloud service. We're going to implement the "hands-free" mode for getting access to the restricted area. It means:

  • user don't need to get a smartphone to enable the access (it should work the whole work day)
  • the smartphone should scan/find BLE controllers in the background mode.

My thoughts:

Plan 'A' is using a combination of

  1. Foreground service (working in the active mode)
  2. FCM high-priority messaging (waking up in the Doze Mode)

Plan 'B' is using the white-list apps of Android to prevent battery optimisation in the Doze mode.

Maxim Firsoff
  • 2,038
  • 22
  • 28

1 Answers1

0

You don't need the app to stay alive if you just want to perform a background BLE scan. Just use the PendingIntent BLE scan feature https://developer.android.com/reference/android/bluetooth/le/BluetoothLeScanner#startScan(java.util.List%3Candroid.bluetooth.le.ScanFilter%3E,%20android.bluetooth.le.ScanSettings,%20android.app.PendingIntent). Then your app process will be started when an advertisement packet matching your filter arrives.

Emil
  • 16,784
  • 2
  • 41
  • 52