Giter Club home page Giter Club logo

Comments (4)

Cakey123445 avatar Cakey123445 commented on September 14, 2024

You should really add a listener to the getAllLightsCollection() otherwise you are just relying on getting lucky and a bulb being found in between when you connect and when you call get all lights.

You then don't need to worry about timings and such. Some snippets from my controller fragment below:

public class FragmentLIFXController extends Fragment implements LFXLightCollectionListener {

@Override
public void onStart() {
  super.onStart();
  Log.d(TAG,"onStart()");

  if(mLIFXContext==null) {
    mLIFXContext=LFXClient.getSharedInstance(getActivity()).getLocalNetworkContext();
    mLIFXContext.connect();

    LFXLightCollection lc=mLIFXContext.getAllLightsCollection();
    lc.addLightCollectionListener(this);
  }
}

@Override
public void lightCollectionDidAddLight(LFXLightCollection arg0,LFXLight arg1) {
    Log.d(TAG,"lightCollectionDidAddLight() - "+arg1.getLabel()+" - "+arg1.getDeviceID());
}

@Override
public void lightCollectionDidChangeColor(LFXLightCollection arg0,LFXHSBKColor arg1) {
    Log.d(TAG,"lightCollectionDidChangeColor()");       
}

@Override
public void lightCollectionDidChangeFuzzyPowerState(LFXLightCollection arg0, LFXFuzzyPowerState arg1) {
   Log.d(TAG,"lightCollectionDidFuzzyPowerState()");        
}

@Override
public void lightCollectionDidChangeLabel(LFXLightCollection arg0, String arg1) {
    Log.d(TAG,"lightCollectionDidChangeLabel()");
}

@Override
public void lightCollectionDidRemoveLight(LFXLightCollection arg0, LFXLight arg1) {
    Log.d(TAG,"lightCollectionDidRemoveLight()");
}
}

from lifx-sdk-android.

Eonasdan avatar Eonasdan commented on September 14, 2024

the log events don't change for me.

I don't get the networkContextDidConnect events either.

from lifx-sdk-android.

Cakey123445 avatar Cakey123445 commented on September 14, 2024

If you are going to pick up the nextworkContextDidConnect then that's a different listener, you'll need to add "implements LFXNetworkContextListener" and whilst many things are broken in the libs then the nextworkContextDidConnect/Disconnect() is working here.

According to Jarrod there is a lib update coming soon.

from lifx-sdk-android.

PercyBoyes avatar PercyBoyes commented on September 14, 2024

Thanks for replying here Cakey,

I'm working on an update for the API asap to fix some of the issues you guys are seeing.

from lifx-sdk-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.