Search code examples
javaandroidtaskrulesrule-engine

How to implement periodic data receiving and executing self-defined tasks?


I'm developing an android app which is connected to a BLE device (to receive temperature values) and the OpenWeatherMap API for receiving weather data.

Now i want to request every 30 minutes the OpenWeatherMap API to receive the current values. Which is the best solution for this scenario?

Also i want to check the incoming weather (API) and temperature (BLE) and execute some self-defined task when certain conditions are given. Is a rule engine the way to go for this behavior?

So what are the possibilities that i have to implement the wanted behavior?

  1. Execute the receive task of the OpenWeatherMap API every 30 minutes
  2. Check and compare the received data (API & BLE)
  3. Execute some tasks on defined conditions regarding the received data

Thank you very much in advance


Solution

  • Use work manager, it is recommended way for scheduling and doing long running tasks.

    https://developer.android.com/topic/libraries/architecture/workmanager?gclsrc=ds&gclsrc=ds