M
M
Maxim Firsov2021-02-24 07:31:27
Android
Maxim Firsov, 2021-02-24 07:31:27

How to make a long-lived Foreground Service on Android for BLE scanning?

I am working on an access control system based on a mobile application and a system of Bluetooth-Low-Energy (BLE) controllers. The task is this:
- to implement a "hands-free" mode, when the smartphone is in your pocket and in the background scans for BLE controllers (according to the RSSi level), while the smartphone does not need to be taken out to, say, open the doors controlled by one of the BLE -controller.
Technical requirements:
- scanning operation 1 time per 5 seconds
- work in DozeMode
- API-21 and higher.

Implementation thoughts:
1. use a combination of ForegroundService (for active mode) + FCM high-priority messaging (for DozeMode)
2. use Android apps white-list + ForegroundService.

Has anyone faced a similar problem?

Sincerely.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arsen, 2021-05-16
@Martian97

I faced this issue. But you can simply bonding that device and just check if it is automatically connected. And then read the specifications.
And the most convenient way to do this is through ble libraries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question