Fix ANR by moving service logic into doInBackground