mina
mina

Reputation: 319

codenameone and Opentok native interface

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

I am stuck at point 4 and 5.

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

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

Thank you for your help, Amina

Upvotes: 4

Views: 69

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

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

mSession.setSessionListener(this);

You can probably just use:

mSession.setSessionListener(myObject);

Where myObject would just be a class you create and place next to the regular native class that implements this interface.

Another point of interest is the onCreate or other callbacks you might need. onCreate can probably be mapped to our lifecycle methods thru a native interface but you can also use addLifecycleListener which should work roughly 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() {}
});

Upvotes: 2

Related Questions