Android Open Source - Seraccoli-Android-Webservice Custom Web Service






From Project

Back to project page Seraccoli-Android-Webservice.

License

The source code is released under:

Apache License

If you think the Android project Seraccoli-Android-Webservice listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.guster.brandon.webservice;
/*from w  ww  . ja va 2  s. c  o  m*/
import android.content.Context;
import com.guster.brandon.library.webservice.RequestHandler;
import com.guster.brandon.library.webservice.WebService;
import org.json.JSONObject;

/**
 * Created by Gusterwoei on 9/10/14.
 * Simple Custom WebService
 */
public class CustomWebService extends WebService {

    private RequestHandler rh;

    public CustomWebService(Context context) {
        super(context);
        rh = init().setConnectionTimeout(60000)
                .setSocketTimeout(60000);
    }

    public void setListener(RequestHandler.WebServiceListener listener) {
        rh.setListener(listener);
    }

    public void getFacebookPage() {
        String url = "http://www.facebook.com";
        rh.get(url);
    }

    public void sendPostRequest(JSONObject payload) {
        String url = "http://date.jsontest.com";
        rh.post(url, payload.toString());
    }
}




Java Source Code List

com.guster.brandon.library.MainActivity.java
com.guster.brandon.library.webservice.HttpAuthenticator.java
com.guster.brandon.library.webservice.RequestHandler.java
com.guster.brandon.library.webservice.Response.java
com.guster.brandon.library.webservice.WebService.java
com.guster.brandon.webservice.CustomWebService.java
com.guster.brandon.webservice.MainActivity.java
com.guster.brandon.webservice.MainFragment.java