About foreground service in an android app

I am making an app which gives me alert every 5 min and 15 min.
I want 5 min and 15 min alert should work independant, start and stop button for both.
I want to customize the starting time for both.
Also, when 15 min alert sounds, there should not be 5min alert within 2 min.
I have made comparison of the current timer and customized 5min and 15min times using Clock1.Timer.
But when I closes screen, it stops working in few minutes.
I read about itoo extension,tried but with not much understanding.
I need to keep the screen awake to get alerts. I want reliable alerts even after screen is locked. Please help.

If you want to use a foreground service, then the only possibility is to get familiar with the itoo extension Open Source • Background Tasks: Itoo 🚀

However there are 2 main disadvantages for your use case

Usually you do not want a persistent notification being displayed for the user while your background process is running, which is required for itoo

Also usually you want to keep battery usage of your device as low as possible... a process running in the background to compare regularly if it is already time to send a notification drains your battery...

That's why usually you would use the alarmmanager functionality of the Android operating system to get triggered at the given time. My paid alarmmanager extension would be able to help...

Taifun

you might be able to do a foreground service using

also consider

The UrsAI2KeepAlive zip archive

https://ullisroboterseite.de/android-AI2-KeepAwake-en.html

The archive contains the source code, the compiled binary for uploading to the App Inventor and a discussion of how Ullis' Foreground extensions work.