开发者

execute service at particular time android

开发者 https://www.devze.com 2023-03-02 18:42 出处:网络
I am making GPS tracker application, and after 1 hrs I got the updated data and store into data base.

I am making GPS tracker application, and after 1 hrs I got the updated data and store into data base. then 开发者_JS百科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


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消