I have an AlarmManager
which sets a repeating alarm.
(Not actually an alarm, but send mail). So in the BroadcastReceiver I do the actual sending of the mail. But to send mail one needs Internet. So when the phone doesn't have an Internet connection the email doesn't get sent. How do I "snooze"
the action which is inside onReceive() in my BroadcastReceiver? Do I make a new Receiver which fires with this (when phon haz internietz) or???
private boolean isNetworkAvailable() {
ConnectivityManager cm
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ai= cm.getActiveNetworkInfo();
return ai!= null;
}
EDIT: Got it to work. Used a IntentService which checks every 10 minutes if internet is avaliable, and if: send mail. The IntentService is started from my BroadcastReceiver, where the email initially is to be sent, if there's no internet.