You can use this to send an HTTP POST request to a URL. You can easily send request and get response. I always use this . I fine work to me.
///////////////////// Check SubScription ////////////////////
try {
AsyncHttpClient client = new AsyncHttpClient();
// Http Request Params Object
RequestParams params = new RequestParams();
String u = "B2mGaME";
String au = "gamewrapperB2M";
// String mob = "880xxxxxxxxxx";
params.put("usr", u.toString());
params.put("aut", au.toString());
params.put("uph", MobileNo.toString());
// params.put("uph", mob.toString());
client.post("http://196.6.13.12:80/ws/game_wrapper_reg_check.php", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
playStatus = response;
//////Get your Response/////
Log.i(getClass().getSimpleName(), "Response SP Status. " + playStatus);
}
@Override
public void onFailure(Throwable throwable) {
super.onFailure(throwable);
}
});
} catch (Exception e) {
e.printStackTrace();
}
You Also need to Add bellow Jar file in libs folde
android-async-http-1.3.1.jar
Finally edit your build.gradle
dependencies {
compile files('libs/<android-async-http-1.3.1.jar>')
}
In the last Rebuild your project.
No comments:
Post a Comment