How To Make The App Never Being Closed

Maybe this will help someone ?! The application does not work in the background process. I thought for a long time and I did it. When the application is minimized and the screen is closed, then in the application I turn on a timer that every 3 seconds turns on the audio player and emits an empty sound lasting 100 ms. I noticed that if you set the timer for more than 4 seconds, then the android starts turning off the background activity. This method restricts (interrupts) the normal operation of audio and video players, but for my security system application with push notifications, this was the only way out. If there are other options, tell me!
Screenshot_36

3 Likes