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();
}
});
}
I know its too late, but if someone have same problem (status -101) and internet permission are present, but you still got -101 try this add line in your application tag of your manifest.xml
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Add this permission in AndroidManifest.xml :
<uses-permission android:name="android.permission.INTERNET"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With