My app has certain features that are only activated with a network connection is present. I have the code in place to check for a connection, but I'm not sure how I should go about doing constant checks.
I want to check for an active connection in the background once every 2-3 seconds.
...Check for connection ...Wait a few seconds ...Check for connection ...Wait a few seconds ...Check for connection ...Wait a few seconds ...etc
I originally put it in a loop in an IntentService, but I heard you shouldn't run endless loops in IntentServices because they will eventually be terminated. Then read it might be good to use an Alarm but heard from someone else to limit alarms to once per minute or so, otherwise it will cause bad battery drain.
What would be a good way to approach this?