hi
in first i have to explain context:
From several months i was looking for a simple way to alert family in case of trouble of old peoples. At start i use SOS alert bracelet able to send 433mhz message when button is pressed. (cost 8€). I found a gateway 433mhz: SONOFF RF bridge (cost 10€). After installation of tasmota on this bridge, i am able to send MQTT messages to a MQTT broker (cloudMQTT.com, free until 5 connexions). At last i was looking at an application under android to receive MQTT messages and to highlight in case of alert message. Because i I found nothing able to do that on GooglePlay, i decided to try to do an apk with B4A
with B4A, i built an apk based on all examples available on this forum and at last it is working when apk is open, with apk in background, when datas are moving between 4G - WIFI, and when mobile is locked. To have service not killed, i have to remove in mobile batterie optimisation for this apk. But at last i am facing a major issue: service in charge of MQTT message is running full time and it is drainning 30% of global drain of mobile...
and i have a few questions:
- do we have a way to reduce this battery drain?
- can you check if my management of service is correct?
code is added below, to help at understanding
thanks for your help