{"action":"created","issue":{"url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21","labels_url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21/comments","events_url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21/events","html_url":"https://github.com/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21","id":101292796,"number":21,"title":"Program Dangling? (Thread still active)","user":{"login":"ztan222","id":13682923,"avatar_url":"https://avatars.githubusercontent.com/u/13682923?v=3","gravatar_id":"","url":"https://api.github.com/users/ztan222","html_url":"https://github.com/ztan222","followers_url":"https://api.github.com/users/ztan222/followers","following_url":"https://api.github.com/users/ztan222/following{/other_user}","gists_url":"https://api.github.com/users/ztan222/gists{/gist_id}","starred_url":"https://api.github.com/users/ztan222/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ztan222/subscriptions","organizations_url":"https://api.github.com/users/ztan222/orgs","repos_url":"https://api.github.com/users/ztan222/repos","events_url":"https://api.github.com/users/ztan222/events{/privacy}","received_events_url":"https://api.github.com/users/ztan222/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-16T19:36:03Z","updated_at":"2015-09-03T09:23:11Z","closed_at":"2015-09-03T09:23:11Z","body":"Hello,\r\n\r\nI think this is going back to a previous issue listed here - https://github.com/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/13. \r\n\r\nI have built a java program where I want to change a few configurations on the lights. To keep it as relevant as possible, here is the following code I altered from the original Java Desktop App:\r\n\r\n     private PHSDKListener listener = new PHSDKListener() {\r\n\r\n            @Override\r\n            public void onAccessPointsFound(List<PHAccessPoint> accessPointsList) {\r\n        \t    System.out.println(\"INFO: Found Access Points! Using the first one\");\r\n        \t\r\n        \t    // Get the first Access Point listed\r\n        \t    phHueSDK.connect(accessPointsList.get(0));\r\n            }\r\n\r\n            @Override\r\n            public void onAuthenticationRequired(PHAccessPoint accessPoint) {\r\n                // Start the Pushlink Authentication.\r\n                System.out.println(\"INFO: Press the link button on the bridge to authenticate\");\r\n                phHueSDK.startPushlinkAuthentication(accessPoint);\r\n            }\r\n\r\n            @Override\r\n            public void onBridgeConnected(PHBridge bridge, String username) {        \t\r\n        \t    phHueSDK.stopPushlinkAuthentication();\r\n        \t\r\n        \t    System.out.println(\"Connected to the bridge!\");\r\n        \t\r\n                phHueSDK.setSelectedBridge(bridge);\r\n                phHueSDK.enableHeartbeat(bridge, PHHueSDK.HB_INTERVAL);\r\n                String lastIpAddress =  bridge.getResourceCache().getBridgeConfiguration().getIpAddress();   \r\n                HueProperties.storeUsername(username);\r\n                HueProperties.storeLastIPAddress(lastIpAddress);\r\n                HueProperties.saveProperties();\r\n            \r\n                randomLights();\r\n            \r\n                phHueSDK.disableAllHeartbeat();\r\n                phHueSDK.destroySDK();\r\n            }\r\n\r\n            ...\r\n\r\n\r\nAs you can see in the \"onBridgeConnected()\", I want to run the \"randomLights()\" method as soon as I am connected to the bridge and then immediately close the SDK and exit the program. I found that if the properties are saved in a separate file, this works completely fine. However, if  I run this for the very first time where I have to to push the link button for authentication, the program dangles and does not exit. Any suggestions on how to fix this issue? I know I can use System.exit() but feel that this is the unclean version of how to fix the issue.\r\n\r\nThank you,\r\nZack"},"comment":{"url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/comments/137389511","html_url":"https://github.com/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21#issuecomment-137389511","issue_url":"https://api.github.com/repos/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/issues/21","id":137389511,"user":{"login":"SteveyO","id":5211958,"avatar_url":"https://avatars.githubusercontent.com/u/5211958?v=3","gravatar_id":"","url":"https://api.github.com/users/SteveyO","html_url":"https://github.com/SteveyO","followers_url":"https://api.github.com/users/SteveyO/followers","following_url":"https://api.github.com/users/SteveyO/following{/other_user}","gists_url":"https://api.github.com/users/SteveyO/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveyO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveyO/subscriptions","organizations_url":"https://api.github.com/users/SteveyO/orgs","repos_url":"https://api.github.com/users/SteveyO/repos","events_url":"https://api.github.com/users/SteveyO/events{/privacy}","received_events_url":"https://api.github.com/users/SteveyO/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T09:23:11Z","updated_at":"2015-09-03T09:23:11Z","body":"Hi Zack,\r\n   \r\nI have just committed a fix in the new SDK (v. 1.8.2).  If you pull in the huelocalsdk.jar  (from either QuickStart or JavaDesktop libs folder) the SDK should now be killed correctly if Pushlinking has been run.\r\n\r\nI will close the issue,  so let me know if you have any issues, in which case I will re-open it.\r\n\r\nSteve"}}