i have looked at many places, tried a ton of things but nothing to seem to work for me somehow. Can anyone please help me here. I have a simple url that i want to hit without opening the browser in mobile phones. I am clicking a button and that url needs to get hit, without the browser getting opened. I am not concerned with what is on that page i just want to load it. I basically need it for my arduino cum ethernet shield IOT project, wherein i am controlling my appliances with my android phone.
Here is a snippet of what i am doing. The apk is generating without errors but the url is not getting hit somehow.
Thankyou
public void led1on(View view){
try {
URL u = new URL("http://172.17.27.173/?2");
HttpURLConnection http = (HttpURLConnection) u.openConnection();
http.connect();
}catch (Exception e){
e.getMessage();
e.printStackTrace();
}
}