I\'ve got a problem for a long time now and I discovered cwac-wakeful, which could solve all my problems. I thought... :\'( In short, for solving the problem, I\'ve implemented
In terms of the time gap, most likely, you are experiencing Doze mode on Android 6.0+ devices, or the equivalent offered by some manufacturers on older devices (e.g., SONY's STAMINA mode). Other than adding your app to the appropriate whitelist (e.g., for Doze, Settings > Apps > (gear icon) > Special access > Battery optimization), there is very little that you can do.
You are welcome to switch to setExactAndAllowWhileIdle()
on API Level 23+ devices, however:
You will not get control every minute (I think it is limited to every 9 minutes)
You will not have Internet access when you do get control (which presumably is required for whatever you are trying to do for real)
This will not help for manufacturer-specific pre-6.0 devices (since that method does not exist)
Overall, designing your app to deal with Doze mode, and not assume that it will get control much in the background, is a more reliable approach.