简体   繁体   中英

Change event in Android/custom event

我有一个服务每隔X分钟轮询一次数据,Android上的屏幕可能处于打开/关闭状态,但是,我的服务必须完成其工作以通知主要活动数据已更改(如果主屏幕会更新数据,数据已更改),是否有办法实现?

You can use ContentObserver to achieve it. Register your Activity as ContentObserver, it will get notified whenever there's change in Data (Content).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM