I’ve worked with AlarmManager before but I only use it for when I want to run a code that is time specific when the app is not being used. Is there a way to create an AlarmManager that runs a code when the app is being used but it should stop when the app is closed?
I want it to run every five seconds or so if possible (one minute is the lowest that I know), and I can’t find any tutorials online to help me. Thank you!