我正在寻找一个监听器,当与桥接器的连接丢失时通知我。
我发现但不起作用:
我注册了一个应该触发列出的事件的监听器,但不知道它不会。
@Override
protected void onCreate(Bundle savedInstanceState) {
phHueSDK = PHHueSDK.create();
phHueSDK.getNotificationManager().registerSDKListener(listener);
}
private PHSDKListener listener = new PHSDKListener() {
@Override
public void onCacheUpdated(List<Integer> list, PHBridge phBridge) {
}
@Override
public void onBridgeConnected(PHBridge phBridge, String s) {
Log.d("hue", "bridge connected");
}
@Override
public void onAuthenticationRequired(PHAccessPoint phAccessPoint) {
}
@Override
public void onAccessPointsFound(List<PHAccessPoint> list) {
}
@Override
public void onError(int i, String s) {
}
@Override
public void onConnectionResumed(PHBridge phBridge) {
Log.d("hue", "connection resumed");
showNotification();
}
@Override
public void onConnectionLost(PHAccessPoint phAccessPoint) {
Log.d("hue", "connection lost");
removeNotification();
}
@Override
public void onParsingErrors(List<PHHueParsingError> list) {
}
};