Does JitsiMeetViewListener work out of the box for Android?


#1

Hi,

I’ve recently downloaded the source for the Jitsi-meet Android app and got it up and running. The only changes I’ve made so far have been around newIntent - passing in a bundle from another app to get calls up and running instantly. I’m trying to act upon events thrown by the JitsiMeetViewListener class, however I’m struggling to get any of them firing. I’ve not changed the code from the repo:

@Override
protected JitsiMeetView initializeView() {
    JitsiMeetView view = super.initializeView();

    // XXX In order to increase (1) awareness of API breakages and (2) API
    // coverage, utilize JitsiMeetViewListener in the Debug configuration of
    // the app.
    //if (BuildConfig.DEBUG && view != null) {
        view.setListener(new JitsiMeetViewListener() {
            private void on(String name, Map<String, Object> data) {
                UiThreadUtil.assertOnUiThread();

                // Log with the tag "ReactNative" in order to have the log
                // visible in react-native log-android as well.
                Log.d(
                    "ReactNative",
                    JitsiMeetViewListener.class.getSimpleName() + " "
                        + name + " "
                        + data);
            }

            @Override
            public void onConferenceFailed(Map<String, Object> data) {
                on("CONFERENCE_FAILED", data);
            }

            @Override
            public void onConferenceJoined(Map<String, Object> data) {
                on("CONFERENCE_JOINED", data);
            }

            @Override
            public void onConferenceLeft(Map<String, Object> data) {
                on("CONFERENCE_LEFT", data);
            }

            @Override
            public void onConferenceWillJoin(Map<String, Object> data) {
                on("CONFERENCE_WILL_JOIN", data);
            }

            @Override
            public void onConferenceWillLeave(Map<String, Object> data) {
                on("CONFERENCE_WILL_LEAVE", data);
            }

            @Override
            public void onLoadConfigError(Map<String, Object> data) {
                on("LOAD_CONFIG_ERROR", data);
            }
        });

        // inviteController
        final InviteController inviteController
            = view.getInviteController();

        inviteController.setListener(new InviteControllerListener() {
            public void beginAddPeople(
                    AddPeopleController addPeopleController) {
                onInviteControllerBeginAddPeople(
                    inviteController,
                    addPeopleController);
            }
        });
        inviteController.setAddPeopleEnabled(
            ADD_PEOPLE_CONTROLLER_QUERY != null);
        inviteController.setDialOutEnabled(
            inviteController.isAddPeopleEnabled());
    //}

    return view;
}

After stepping through the code it looks as though this:

private static final Map<String, Method> LISTENER_METHODS = ListenerUtils.mapListenerMethods(JitsiMeetViewListener.class);

Is never being populated, so no methods are mapped as part of the event setup. I must be missing something here as no one else seems to be complaining :slight_smile:

I’m pointing the app at our own install of the jitsi server, but unless the app needs config or something from it I can’t see how that would be the issue?

Any help much appreciated!

Cheers.

Paul


#2

Downloaded the github project, did a gradle clean and a ‘react-native run-android’, still not hitting any breakpoints on the JitsiMeetViewListener… What am I missing :thinking:


#3

Hi Paul,

It should work… unless we broke it :open_mouth: I’m making changes in the surroundings, I’ll take a look in the next few weeks.

Cheers,


#4

Thanks for the reply.

I stepped through a bit more, and the issue was definitely around ListenerUtils.mapListenerMethods(JitsiMeetViewListener.class). Essentially the getDeclaredMethods() on the listener class was always returning an empty list. I tried this with my own class on the mainActivity ITest.class.getDeclaredMethods() and this also returned empty.

So - upshot is, it looks as though Proguard (not really used much it but it looks like the guilty party) is stripping something out at runtime? I commented out proguard in the gradle file and I was getting the 6 methods back from JitsiMeetViewListener.class.getDeclaredMethods(), and consequently the callbacks are now being fired…

I assume a ‘keep’ into the proguard files for the listener would sort this?

Cheers.

Paul


#5

Hey Paul! Nice find! That would solve it indeed. Can you test if this does the job?

-keep class org.jitsi.meet.sdk.** { *; }

Cheers,


#6

Cheers! I’ll give that a go now - you’ll have to excuse the basic question, but could you prompt me in the direction of which pro guard file this needs to go in?

I assume you’d want this in debug and release, but I can also see files for app and sdk…


#7

It should go here: https://github.com/jitsi/jitsi-meet/blob/master/android/app/proguard-rules.pro which is used both for debug and release.

I noticed there is an unused one in the sdk/ directory. You can disregard that.


#8

Thought it was - I’ll be a proguard expert in no time :slightly_smiling_face:

That worked a treat - proguard back in and events firing!


#9

Thanks for confirming Paul!


#10

No worries. Thanks for the help/quick replies.