android - Control an LED through internet -
i creating android app control led through internet. first built application using app inventor , it's working fine shown in video:
https://www.youtube.com/watch?v=b-2cygm9qns&list=llog_1ypenk_yx8ypnprgpua&index=2
now trying build same application using android studio , facing problem, not getting exact output got app inventor
here code button:
public void on(view view) { intent led_on = new intent(intent.action_view,uri.parse("192.168.43.104/led=on")); startactivity(led_on); }
created button should turn on led, it's going webpage how without going webpage done in app inventor?
you don't want start activity when clicking on button, doing get request instead.
update:
it seems don't care response of request, can like:
public void on(view view) { httpclient httpclient = new defaulthttpclient(); httpclient.execute(new httpget("192.168.43.104/led=on")); }
make sure have internet permission in androidmanifest.xml
:
<uses-permission android:name="android.permission.internet" />
Comments
Post a Comment