Phillips Hue

Ich habe jetzt in AS angefangen. Leider finde ich kein Handbuch, das mir wirklich alle Methoden der SDK zeigen. Die App crasht nun immer, nachdem Bridge suchen.
public class BridgeFinder  {
    PHHueSDK phHueSDK;
    public BridgeFinder() {
        phHueSDK = PHHueSDK.getInstance();
        phHueSDK.setAppName("Hue App");     // e.g. phHueSDK.setAppName("QuickStartApp");
        phHueSDK.setDeviceName(android.os.Build.MODEL);  // e.g. If you are programming for Android: phHueSDK.setDeviceName(android.os.Build.MODEL);
        phHueSDK = PHHueSDK.create();  // or call .getInstance() effectively the same.

        // Register the PHSDKListener to receive callbacks from the bridge.

        PHBridgeSearchManager sm = (PHBridgeSearchManager) phHueSDK.getSDKService(PHHueSDK.SEARCH_BRIDGE);

//hier liegt vermutlich der Fehler:, true);


    // Local SDK Listener
    private PHSDKListener listener = new PHSDKListener() {

        public void onAccessPointsFound(List accessPoint) {
            // Handle your bridge search results here.  Typically if multiple results are returned you will want to display them in a list
            // and let the user select their bridge.   If one is found you may opt to connect automatically to that bridge.

        public void onCacheUpdated(List cacheNotificationsList, PHBridge bridge) {
            // Here you receive notifications that the BridgeResource Cache was updated. Use the PHMessageType to
            // check which cache was updated, e.g.
            if (cacheNotificationsList.contains(PHMessageType.LIGHTS_CACHE_UPDATED)) {
                System.out.println("Lights Cache Updated ");

        public void onBridgeConnected(PHBridge b, String username) {
            phHueSDK.enableHeartbeat(b, PHHueSDK.HB_INTERVAL);
           // Here it is recommended to set your connected bridge in your sdk object (as above) and start the heartbeat.
            // At this point you are connected to a bridge so you should pass control to your main program/activity.
            // The username is generated randomly by the bridge.
            // Also it is recommended you store the connected IP Address/ Username in your app here.  This will allow easy automatic connection on subsequent use.

        public void onAuthenticationRequired(PHAccessPoint accessPoint) {
            // Arriving here indicates that Pushlinking is required (to prove the User has physical access to the bridge).  Typically here
            // you will display a pushlink image (with a timer) indicating to to the user they need to push the button on their bridge within 30 seconds.

        public void onConnectionResumed(PHBridge bridge) {


        public void onConnectionLost(PHAccessPoint accessPoint) {
            // Here you would handle the loss of connection to your bridge.

        public void onError(int code, final String message) {
            // Here you can handle events such as Bridge Not Responding, Authentication Failed and Bridge Not Found

        public void onParsingErrors(List parsingErrorsList) {
            // Any JSON parsing errors are returned here.  Typically your program should never return these.
Passende Stellenanzeigen aus deiner Region:

Neue Themen