I always want to check the current time on my device and display a notification. But using this code, I can only get the time I open the app
How can I do this background check, and when it arrives at the specified time the app sends me the notification.
Thank you in advance
SimpleDateFormat dateFormat_hora = new SimpleDateFormat("HH:mm:ss");
Date data = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(data);
Date data_atual = cal.getTime();
String hora_atual = dateFormat_hora.format(data_atual);
TextView horaatual = (TextView) findViewById(R.id.horaatual);
horaatual.setText(hora_atual);