开发者

Creating an AsyncTask to use with an AlarmManager

开发者 https://www.devze.com 2023-04-02 06:48 出处:网络
Since I just want to connect to a web service, in order to check whether there is an update or not, or to check whether there is a need to send data to that service, I believe AsyncTask and AlarmManag

Since I just want to connect to a web service, in order to check whether there is an update or not, or to check whether there is a need to send data to that service, I believe AsyncTask and AlarmManager is perfect for this, but I don't know what to do about the Internet connection availability of the user.

Basicly, I think after reaching the time interval I'll constantly check for an internet conn开发者_C百科ection, if available connect to that web service, and after the connections restart the AlarmManager for the next time. What I am missing is the constantly checking internet availability, and using AlarmManager properly for this. Any advice would be great for me...


you can check for internet availability by creating a separate thread with infinite loop..you can implement this thread in service...

for alarm manager refer this doc:

http://developer.android.com/reference/android/app/AlarmManager.html

0

精彩评论

暂无评论...
验证码 换一张
取 消