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?
How do you download the xml feeds? You have to ensure that the data is downloaded correctly.
Also, if you the BroadcastReceiver approach for doing batch background task is better to start a service (when you receive the broadcast event) and that the service do the "weight job" because if the broadcast receiver handler longs more than 10 secs the user will receive a Force Close message and the task will not be complete.