对于我的应用程序,我希望在指定的时间向用户发送一个Notification。为此,我设置了一个Timer和相应的TimerTask。为了确保即使手机处于休眠状态,Notification也会发送给用户,我买了一个PARTIAL_WAKE_LOCK。问题是,这种方法从我的电池中消耗了大量的电力(我的应用程序负责一天结束时所有电力消耗的50%以上)。
有没有其他方法(当然是更节能的方法)来做我想做的事情?
提前感谢您花时间来帮助我。
发布于 2012-05-06 15:50:55
> Is there another way (a more power efficient one of course) to
> [have a Notification sent to the user at a specified time]?你可以使用android的AlarmManager来做这件事。
请参阅Using AlarmManager to Schedule Activities on Android作为教程和示例。
https://stackoverflow.com/questions/10468305
复制相似问题