如何安排我的 android 应用程序每小时做某事 [英] How to schedule my android app to do something every hour

查看:35
本文介绍了如何安排我的 android 应用程序每小时做某事的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的应用程序每小时访问一次数据库并从表中读取下一条记录,然后更新 desctop 小部件并发送通知.我知道有一个 AlarmManager,我可以用它来注册我的意图,但是当手机关闭或重新启动时它们会被删除.

I want my app to access database every hour and read next record from the table then update desctop widget and send notification. I know that there is AlarmManager which I can use to register my Intents but they are deleted when the phone is turned off or rebooted.

是否有任何其他 android 类/服务即使在我重新启动手机时也会持续更新我的应用程序?

Is there any other android class/service that I would update my application continuously even when I reboot my phone?

谢谢,

推荐答案

看看android sdk提供的demo应用

take a look at the demo applications provided with android sdk

http://developer.android.com/samples/RepeatingAlarm/index.html

查看AlarmService_Service 触发警报后服务的实现

the look at AlarmService_Service for the implementation of the service once the alarm has been triggered

这篇关于如何安排我的 android 应用程序每小时做某事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆