What is the best way to disconnect user after exactly 5min of inactivity on Android?

31 Views Asked by At

I am trying to implement a way of automatically disconnect user after EXACTLY 5 minutes of inactivity on my Android App.

I was using AlarmManager before, but since the last changes on Android 13 & 14, I had to change from exact alarms to inexact, which does not meet my needs.

I tried using WorkManager but the fact that "killing" the app from the multitasks screen does not terminate my workers is a problem.

0

There are 0 best solutions below