Android 调度或计时器 APIme
如果我问一些基于讨论的问题,请原谅我。我对 Android 环境完全陌生,我正在开发一个基于 Android 的应用程序,其中我需要对我的项目的消息系统进行一些修改。其中我需要为传出消息使用计时器设施,用户可以为他的消息计时,以便在预定的时间,短信应该自动发送。我想知道哪个消息 API 可以帮助我实现这一点。我可以感觉到这不符合要问的问题,但我在每个网站上进行了搜索,但所有工作都是徒劳的。希望能得到贵方的积极答复。
Pardon me if m asking some discussion based questions. I am completely new to android environment and I am developing an android based application wherein i need to apply some modification in messaging system for my project. therein i need to employ a timer facility for the outgoing messages where user could be able to time his message so that at that scheduled time, the sms should go automatically. I want to know which messaging API will help me in implementing so. I can sense that dis is not upto the mark question to be asked but i searched on every site but all work in vain. Hoping to get a positive reply from your side.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你应该看看 ScheduledExecutorService
我认为这就是你的正在寻找。该服务能够在后台执行基于 TimeUnit 的任务。
You should have a look at ScheduledExecutorService
i think this is what you are searching for. This service is able to execute tasks based on TimeUnits in the background.
您可能还想查看
AlarmManager
。您可以使用它在将来的某个时间发送自定义 Intent。它可能比其他类型的计时器更好(取决于您的情况),因为它会在意图传递时导致手机唤醒。否则,如果 CPU 处于睡眠状态,您的代码可能无法运行。You might also want to check out
AlarmManager
. You can use it to send a custom Intent at some time in the future. It might be better than other kinds of timers (depending on your situation), because it will cause the phone to wake up when the intent is delivered. Otherwise, your code might not run if the CPU is asleep.