@Override public void onReceive(final Context context, final Intent intent) { if (NetworkUtilities.isNetworkAvailable(context)) { try { Cursor queueCursor = context .getContentResolver() .query( AlexandriaContract.QueueEntry.CONTENT_URI, null, // leaving "columns" null just returns all the columns. null, // cols for "where" clause null, // values for "where" clause null // sort order ); if (queueCursor == null) { return; } if (queueCursor.getCount() > 0) { while (queueCursor.moveToNext()) { int idx_ean = queueCursor.getColumnIndex(AlexandriaContract.QueueEntry._ID); String ean = queueCursor.getString(idx_ean); Log.e(LOG_TAG, "Fetch Book " + ean); Intent bookIntent = new Intent(context, BookService.class); bookIntent.putExtra(BookService.EAN, ean); bookIntent.setAction(BookService.FETCH_BOOK); context.startService(bookIntent); } } queueCursor.close(); } catch (NullPointerException e) { Log.e(LOG_TAG, e.getMessage()); } Log.e(LOG_TAG, "Book queue is clear"); } else { Log.e(LOG_TAG, "No connection available"); } }