Bellafaire / Android-Companion-App-For-BLE-Devices

Provides an open source app which can send phone notifications and control phone functions over BLE
MIT License
43 stars 7 forks source link

Is there any way to maximize energy efficiency through software? #7

Closed themelispan closed 2 years ago

themelispan commented 2 years ago

Your current example code uses void loop() and pings the phone every one second which I suppose is for the sake of keeping it simple.

Is there any way that I could get a special message on my esp whenever the phone receives a new notification (and then do a request from the esp using the /notification command) so that I don't have to ping it all the time? This looks incredibly wasteful of energy

Bellafaire commented 2 years ago

At the moment no such feature exists in this app, it's in need of some reworking. Personally in my watch project for which this app was designed (https://github.com/Bellafaire/ESP32-Smart-Watch) I poll the phone only once when the watch wakes from sleep. After the first connection the app spawns a background service and will automatically reconnect to the ESP32 as long as its advertising. There's currently no way to check the number of notifications other than to read the full string, I'm thinking of ways to improve this app but I'm not totally sure on which direction to take it quite yet.

themelispan commented 2 years ago

The number of notification can be counted using the /notifications command but that's not my problem. I want to be notified on my ESP32 in real time so currently, pinging the phone all the time is my only option

Bellafaire commented 2 years ago

This feature is now supported, the ESP32 example shows how to receive a callback on notifications being posted or removed.