My JsonObjectRequest doesn't do as my instructions. Does volley API go on strike? My log cat just says "Requested URL: http://..". My log cat doesn't say neither "Json Parsing Error:" or "HTTP Request Error:". Please, anybody, tell me What did I do wrong.
String url = REST_URL + "?seq=" + mLastSeq;
Log.i(DEBUG_TAG, "Requested URL: "+url);
JsonObjectRequest req = new JsonObjectRequest(url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
mLastSeq = response.getInt("last");
mNewCount = response.getInt("count");
Log.i(DEBUG_TAG, mLastSeq+"");
Log.i(DEBUG_TAG, mNewCount+"");
if (mNewCount>0) {
String title = mCtx.getResources().getString(R.string.app_name);
String message = mCtx.getResources().getString(R.string.new_news_alert);
showNotification(title, message);
}
} catch (JSONException error) {
Log.d(DEBUG_TAG, "Json Parsing Error: " + error.getMessage());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(DEBUG_TAG, "HTTP Request Error:" + error.getMessage());
}
});
The application may be doing too much work on its main thread.