I am trying to parse a xml from some source and store the results in database in a service that is a alarm based service that runs every day at 6 am and it works fine when my app is not visible or is in background but when it is visible and the service try to parse the xml(at 6am) application stucks and after some time i get a ANR exception.
Thanx.
Use a
IntentServiceinstead of aServiceclass which in android runs in a separate thread as below: