It has come to my attention that Android 5.1 no longer accepts recurring alarms for time intervals shorter than 60 seconds (source).
I am developing an application that logs information about wireless networks. For the operation of the application it is imperative that it can perform its operations every 1-2 seconds and that it doesn't get killed or suspended by the operating system even if it is using a lot of resources. Reliable operation over long periods of time (several hours) is the most important thing. Impact on battery life is not a concern.
So far the most reliable way of achieving this functionality has been to use recurring alarms. Now with Android 5.1 that is no longer an option. What would be my best options for replacing the AlarmManager implementation?
As a workaround you can set up 60 alarms to get flexible solution for your current implementation. Check OS version and set up as many alarms as you need.
But for a long-term solution I suggest you to implement sticky foreground service which would work similar to music player. Something simple like Handler.postDelayed should be enough to keep it alive. The reason to do this way is that alarms are not accurate and it is always better to have some control on the process.