http post - Android HttpClient.execute not working -


i have asynctask follow:

@override protected arraylist<string> doinbackground(string... params) {     arraylist<string> result=new arraylist<>();     try {          httpclient httpclient = new defaulthttpclient();         httppost httppost = new httppost(constants.url);         // add data         list<basicnamevaluepair> namevaluepairs = new arraylist<basicnamevaluepair>(                 2);         namevaluepairs.add(new basicnamevaluepair("id",params[0]));          httppost.setentity(new urlencodedformentity(namevaluepairs, "utf-8"));          // execute http post request         httpresponse response = httpclient.execute(httppost);          httpentity httpentity = response.getentity();         inputstream = httpentity.getcontent();          // deal response here         ....       } catch (exception e) {         log.e("debug", e + " " + e.getmessage());     }      return result; } 

however, on jellybean, after running app time, code runs httpclient.execute(httppost) , stops right there.

can me on that?

try things:

1.check network connection , server availability.

2.check have added internet permission manifest.

<manifest xlmns:android...> <uses-permission android:name="android.permission.internet" /> <application ... </manifest> 

if didn't misunderstand "after time", saying never successes , stops there. because of permissions or net connection because request seems not return.

if runs yes not others, think must due server side.

i recommend using https://github.com/matessoftwaresolutions/androidhttprestservice

i promise push new commit android studio folder structure.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -