'Android background updates

I have set my app to update four xml feeds in the background (if a user has selected the option) via an AlarmManager and a BroadcastReceiver.

This works perfectly on a wi-fi network, however, sometimes if it is using the mobile network for data and the process is a bit slower, by the 2nd or 3rd feed, the feed isn't fully fetched and I get an ParseException saying "unexpected end of document".

Is this a case of BroadcastReceiver not being the right option, or is it something else?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source