I have the following code that sends alerts when the expiration time is over, the problem is that it is sent every minute and it is very tedious since the ACTION_TIME_TICK sends the alert every minute, is there any way to send the same message but every 24 hours?
_broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent)
{
if (intent.getAction().compareTo(Intent.ACTION_TIME_TICK) == 0) {
strFecha = _sdfWatchTime.format(new Date());
}
try {
String fechaExpe= "2018-09-01";
fechaExp = formatoDelTexto.parse(fechaExpe);
date1 = formatoDelTexto.parse(strFecha);
}catch (ParseException e) { // Insert this block.
// TODO Auto-generated catch block
e.printStackTrace();
}
int compa = date1.compareTo(fechaExp);
if(compa>0 || compa==0){
AlertFechaExpe();
}
}
};
registerReceiver(_broadcastReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));