I am making GPS tracker application, and after 1 hrs I got the updated data and store into data base. then at 12AM I want to send all data to particular email ID. So what I have to use so it send email at 12AM only
Asked
Active
Viewed 598 times
1 Answers
0
Use an AlarmManager
. You set the time with:
setInexactRepeating (AlarmManager.RTC_WAKEUP,
triggerAtTime,
myIntent,
AlarmManager.INTERVAL_DAY)
http://developer.android.com/reference/android/app/AlarmManager.html
BTW, you do not want to execute a Service
at that time. You want your Service
to execute an Activity
.
There's a snippet with details on how to implement it here: Android: How to use AlarmManager
I actually answered before a similar question: how do i set an alarm manager to fire every on specific day of week and time in android?
-
I am confuse what will be the triggerAtTime value if I wan to execute at 12AM every day – stuti May 05 '11 at 06:01
-
@stuti you need to use a `Calendar` and set up when you want it (in millis). I added a new link with an answer of my own from some time ago that should help you. – Aleadam May 05 '11 at 06:09