0
I need to make a make a if
for when past midnight, but how can I get this information even with mobile turned off?
I’m trying like this these days:
date_current = simpleDateFormat.parse(strDate);
if (date_current.getTime() == 0){
dados.setmeianoite(true);
}
However if it passes the midnight while the mobile is in the background or turned off it does not fall on if
, consequently does not do what I want.
What I need to know is if he turned midnight and it’s not midnight.
Running this in a Service to run something in the background? https://developer.android.com/guide/components/services.html
– GabrielLocalhost
Yes, I’m running a service
– Igor Oliveira
Look, to run a program with your phone turned off, just making a pact with the devil.
– Oralista de Sistemas
This question smells like XY problem - I guess you don’t have to give one
setmeianoite(true);
, and see what is the last date something happened and compare it with the current date, if they are on different days.– Victor Stafusa