Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Runnable runnableToggle = new Runnable() {
- @Override
- public void run() {
- try {
- String url = "https://api.lifx.com/v1/lights/" + Bulb.this.ID + "/toggle/";
- URL obj = null;
- try {
- obj = new URL(url);
- } catch (MalformedURLException e) {
- System.out.println("Malformed URL");
- e.printStackTrace();
- }
- assert obj != null;
- HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
- String authS = "Bearer MY_TOKEN";
- con.setRequestProperty("Authorization", authS);
- con.setRequestMethod("POST");
- con.setDoOutput(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
- Thread t = new Thread(deskBulb.runnableToggle);
- t.start();
Add Comment
Please, Sign In to add comment