MFC_Starter MFC_Starter - 19 days ago 6
Android Question

Android studio http server

I want to use an android application to control a http server.
I implemented a wifi shield with some output pins.

If I browse the website, one of the output of the wifi shield is high, if I browse the website, the output is low.

Do you have any idea how I can implement two buttons in an application which "browse" this websites to toggle the output via a button?

Or is there another good idea to control the output of the wifi shield via an android application?

Thanks for your help :)


This should work but you need this permission in Manifest <uses-permission android:name="android.permission.INTERNET" /> and library called Volley

public void onCreate(Bundle savedInstanceState) {

    Button on = (Toolbar) findViewById(;
    Button off = (Toolbar) findViewById(;

    on.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

    on.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {


private void toggleServer(boolean on) {
    RequestQueue queue = Volley.newRequestQueue(this);
    String insertURL;
        insertURL =;
        insertURL =;

    StringRequest request = new StringRequest(Request.Method.GET, insertURL, 
    new Response.Listener<String>() {
        public void onResponse(String response) {

            Log.d("toggleServer", "Everything is OK");
    }, new Response.ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            prefsEdit.putString(SENT_TOKEN_TO_SERVER, "false").apply();
            Log.e("toggleServer", "Error occured");
    }) {