Source:
<code>public final AsyncState getEvents(final long sinceId, final long limit, final OnReceiveEventListener listener) { GetTask eventGetTask = new GetTask(mHttpsCertPath) { @Override protected void onPostExecute(String s) { if (s == null) return; try { JSONArray jsonEvents = new JSONArray(s); long lastId = 0; for (int i = 0; i < jsonEvents.length(); i++) { final JSONObject json = jsonEvents.getJSONObject(i); final String eventType = json.getString("type").toLowerCase(); final long id = json.getLong("id"); Bundle dataBundle = null; if (lastId < id) lastId = id; switch (eventType) { case "itemfinished": case "foldercompletion": case "deviceconnected": case "devicediscovered": case "statechanged": dataBundle = new Bundle(); JSONObject data = json.getJSONObject("data"); for (Iterator<String> keyIterator = data.keys(); keyIterator.hasNext();) { String key = keyIterator.next(); dataBundle.putString(key, data.getString(key)); } String folder = data.optString("folder", null); if ((folder != null) && (data.optString("path", null) == null)) { String folderPath = getPathForFolder(folder); if (folderPath != null) { dataBundle.putString("path", folderPath); } } break; case "ping": break; default: Log.d(TAG, "Unhandled event " + json.getString("type")); } if (dataBundle != null) listener.onEvent(id, eventType, dataBundle); } listener.onDone(lastId); } catch (JSONException e) { Log.w(TAG, "Failed to read events", e); } } }; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) return new AsyncState(eventGetTask.execute(mUrl, GetTask.URI_EVENTS, mApiKey, "since", String.valueOf(sinceId), "limit", String.valueOf(limit))); else <START> return new AsyncState(eventGetTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, mUrl, GetTask.URI_EVENTS, mApiKey, "since", String.valueOf(sinceId), "limit", String.valueOf(limit))); <END> }</code><technical_language>honest care pre-Honeycomb minSdk is 11</technical_language>

Target:
public final void getEvents(final long sinceId, final long limit, final OnReceiveEventListener listener) { GetTask eventGetTask = new GetTask(mHttpsCertPath) { @Override protected void onPostExecute(String s) { if (s == null) return; try { JSONArray jsonEvents = new JSONArray(s); long lastId = 0; for (int i = 0; i < jsonEvents.length(); i++) { final JSONObject json = jsonEvents.getJSONObject(i); final String eventType = json.getString("type").toLowerCase(); final long id = json.getLong("id"); Bundle dataBundle = null; if (lastId < id) lastId = id; switch (eventType) { case "itemfinished": case "foldercompletion": case "deviceconnected": case "devicediscovered": case "statechanged": dataBundle = new Bundle(); JSONObject data = json.getJSONObject("data"); for (Iterator<String> keyIterator = data.keys(); keyIterator.hasNext();) { String key = keyIterator.next(); dataBundle.putString(key, data.getString(key)); } String folder = data.optString("folder", null); if ((folder != null) && (data.optString("path", null) == null)) { String folderPath = getPathForFolder(folder); if (folderPath != null) { dataBundle.putString("path", folderPath); } } break; case "ping": break; default: Log.d(TAG, "Unhandled event " + json.getString("type")); } if (dataBundle != null) listener.onEvent(id, eventType, dataBundle); } listener.onDone(lastId); } catch (JSONException e) { Log.w(TAG, "Failed to read events", e); } } }; eventGetTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, mUrl, GetTask.URI_EVENTS, mApiKey, "since", String.valueOf(sinceId), "limit", String.valueOf(limit)); }