Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Connect twice in one app #19

Open
tomu1907 opened this issue Jul 25, 2015 · 1 comment
Open

Connect twice in one app #19

tomu1907 opened this issue Jul 25, 2015 · 1 comment

Comments

@tomu1907
Copy link

Hi,

I have some special requirements.. ;)

I have an app which is connecting to the bridge as usual -> means that I implemented the connection like in the example (http://www.developers.meethue.com/documentation/java-sdk-getting-started#connectingToABridge).
My app is using a BroadcastReceiver, so it is waking if some events come up. Is this BroadcastReceiver I want to connect to the bridge and do some color changes. The problem is now that it is sometimes not possible to connect because the other part of the app is already connected to the bridge.
I get no error message but it seems to be that the method phHueSDK.isAccessPointConnected(lastAccessPoint) is hanging and do nothing.

Any suggestions how to solve these multiple connect to one bridge?

Thanks!
tomu

@SteveyO
Copy link
Contributor

SteveyO commented Jul 31, 2015

Hi tomu,

It's a bit tricky this one without seeing your code. Nothing immediately springs to mind.
The PHHueSDK is a singleton, so what you are doing should work in theory, providing you have not disconnected from the SDK.

The isAccessPointConnected method loops through the connected bridges, comparing the IP Address in the Bridge Config with the IP Address in the passed lastAccessPoint object. I can't really see how this can hang. Are you sure you are not getting any Exceptions/Errors in LogCat?

When the BroadcastReceiver wakes up, can you add a check to see if
PHHueSDK.getInstance().getSelectedBridge() is null or not
This will at least test to see if your PHSDK singleton is still alive.

Steve

@SteveyO SteveyO closed this as completed Jul 31, 2015
@SteveyO SteveyO reopened this Jul 31, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants