androidjsonaquery

Android query network error -101


I'm developing Android application, where tries to obtain remote JSON file using aquery. Target Version is Android 4.3 (api ver. 18). Before I was trying to get JSON using tumblr API, but I thought that maybe I'm constructing url wrong way, so I decided to try with easier JSON url, which you can see in code below. What I'm getting all over is Network Error with code -101.

I will be grateful for any tip.

public class WeHaveTheMunchiesActivity extends Activity {

private AQuery mAQ;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_viewer);

    mAQ=new AQuery(this);

    String url="http://www.google.com/uds/GnewsSearch?q=Obama&v=1.0";


    mAQ.ajax(url, JSONObject.class, new AjaxCallback<JSONObject>(){
        @Override
        public void callback(String url, JSONObject json, AjaxStatus status){

            Toast.makeText(getApplicationContext(), status.getMessage(),     Toast.LENGTH_SHORT).show();

        }
    });

}

Solution

  • Add this permission in AndroidManifest.xml :

    <uses-permission android:name="android.permission.INTERNET"/>