I was thinking in do it by android app and I read (by google search) using the HttpURLConnection in android, an so far i Got this:
try {
URL url = new URL("http://192.168.0.6/on");//"http://" + btn_id.getTag().toString()
Toast.makeText(MainActivity.this, btn_id.getTag().toString(), Toast.LENGTH_SHORT).show();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
try{
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(false);
//connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
connection.setRequestMethod("GET");
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
connection.connect();
wr.flush();
wr.close();
}catch(Exception e){};
}catch (Exception e){
e.printStackTrace();
}
I tried and it doesnt work. If this approach correct or do I need to use socket?. Im totally new to android, thanks for your help.
Gastón