简体   繁体   中英

android Use service or use alarm manager

I have an application that downloads some data from a webservice using json. I want that when the user does not have the application open, my application connects to webservice and ask if there is new data show, and if so throw a notification, and download new data. Now my question. Do you recommend creating a service and say that every X seconds call json looking for an update? , Recommend Or use the alarm manager class? Any better ideas? Do any tutorial important? thank you very much

I recommend you to use alarm manager that will be trigger at every time X... execute the download..

Why? because if you use services it might be closed at some point and you might end up skipping some updates at a certain time (unknown).

Or just use service knowing that it is ok if its get close at certain point by the system fto free the ram and restart again after.

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