0

I am new for android application development.

In my application i need to listen the every day system date change in background , How to do this,can any one guide me with code.

your response will be appreciated......

  • 1
    Check for following http://stackoverflow.com/questions/19890184/unable-to-run-service-when-date-changes-using-broadcast-receiver and http://stackoverflow.com/questions/27342859/detect-day-change-event-in-broadcast-receiver-in-android – Sumant Apr 12 '16 at 05:26
  • @Sumant the above link is helped me to understanding,thanks for response.... – Nageswara Rao CH Apr 12 '16 at 05:36

1 Answers1

0

Declare Globle Variable

    public static String TODAY_DATE;

Just Do below code in your MainActivity in onCreate Method

TODAY_DATE = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());

It will return system date every day

Dixit Panchal
  • 3,406
  • 1
  • 11
  • 14
  • thanks for response,it is helpful for checking present day date. but i need to check background every day immediate system date change.... – Nageswara Rao CH Apr 12 '16 at 05:34
  • you have to run the service,which periodically check the day and date – Amit Ranjan Apr 12 '16 at 05:35
  • @NageswaraRaoCH why you have to check backgroud, when app start then automatic get date from system DixitPanchal is right to get date. up to you how to determine you in your code – Ravi Vaghela Apr 12 '16 at 05:55
  • If you not satidfy then check link http://stackoverflow.com/questions/21758246/android-action-date-changed-broadcast – Dixit Panchal Apr 12 '16 at 06:20