Codenameone and Opentok's own interface

I am trying to implement step 5 from: https://tokbox.com/developer/tutorials/android/basic-video-chat/#connect

I am stuck at points 4 and 5.

I don't know how to implement them (I'm a new user of the codename).

I don't know if I should use a lifecyclelistener (and if so how ?, because I don't find any documentation), and if not, what should I do?

Thanks for the help, Amin

+3


source to share


1 answer


The sample is just using activity since it works from top to bottom, but I doubt you need that. I assume you can probably create your own class and instance and instead of using:

mSession.setSessionListener(this);

      

Perhaps you are just using:

mSession.setSessionListener(myObject);

      



Where myObject will be just a class that you create and place next to your normal native class that implements this interface.

Another interesting issue is this onCreate

or any other callbacks you might need. onCreate

can be mapped to our lifecycle methods via a native interface, but you can also use addLifecycleListener

which should work something like this:

com.codename1.impl.android.AndroidNativeUtil.addLifecycleListener(new LifecycleListener() {
  public void onCreate(android.os.Bundle savedInstanceState) {
     // ... on create code
  }
  public void onResume() {}
  public void onPause() {}
  public void onDestroy() {}
  public void onSaveInstanceState(android.os.Bundle b) {}
  public void onLowMemory() {}
});

      

+2


source







All Articles