如何更新插件每分钟

编程入门 行业动态 更新时间:2024-10-26 22:24:03
本文介绍了如何更新插件每分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

谁能告诉我更新部件每分钟的最佳方式。

can anyone tell me the best way to update widget every minute.

现在我使用的线程AppWidget内,但有时我得到错误而失败粘结剂的交易!这个错误后,我总是有很多错误的一样,所有的时间,我不能再改变我的插件的看法。

Now i'm using thread inside the AppWidget, but sometimes i get error FAILED BINDER TRANSACTION !!! After that error, i always got a lot of error like that all the time and i can't change the view in my widget again.

感谢

推荐答案

而不是使用在AppWidget一个线程,您将得到更好的使用AlarmManager安排重复AppWidget更新意图,你的code将处理服务适当的。

Rather than using a thread in the AppWidget, you would be better served by using the AlarmManager to schedule a repeating AppWidget Update Intent which your code would handle appropriately.

这种方法的好处是配置的更新速度,并且还可以处理装置睡的情况下(而不是意识到了运行code,甚至睡觉被阻止,因为你的线程是忙的可能性)。

The benefits of this approach is the possibility to configure the update rate, and also handle the case of the device sleeping (and not waking up to run your code, or even being blocked from sleeping because your thread is busy).

有许多examples应该说明使用AlarmManager来提高你的AppWidget更新意图的来龙去脉在互联网附近。

There are numerous examples around the internet that should explain the ins and outs of using the AlarmManager to raise your AppWidget Update Intents.

更多推荐

如何更新插件每分钟

本文发布于:2023-06-07 15:28:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/568624.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:每分钟   插件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!