I have an audio stream playing but want to constantly check if the persons internet connection dropped- and if so- restart the audio stream or at least notify them why it stopped.
I checked the onError for mediaplayer but it doesn't get triggered when internet drops-
I have code to check for an internet connection- but is there a way to run this in the background every minute or so? (when phone goes into standby as well)
public boolean isOnline() {
    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnected()) {
        return true;
    }
    return false;
}
Thanks in advance,
 
     
    