fix(android) fix crash in Android < 10

Activity.registerActivityLifecycleCallbacks is only available in API level 29.

Ref: https://developer.android.com/reference/android/app/Activity.html#registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks)
This commit is contained in:
Saúl Ibarra Corretgé 2022-10-11 10:44:35 +02:00 committed by Saúl Ibarra Corretgé
parent abdc5123eb
commit 768cca6162
2 changed files with 6 additions and 2 deletions

View File

@ -15,6 +15,7 @@
*/
package org.jitsi.meet.sdk;
import android.app.Application;
import android.content.Context;
import android.util.Log;
@ -22,6 +23,7 @@ import androidx.annotation.NonNull;
import androidx.startup.Initializer;
import com.facebook.soloader.SoLoader;
import org.wonday.orientation.OrientationActivityLifecycle;
import java.util.Collections;
import java.util.List;
@ -37,6 +39,10 @@ public class JitsiInitializer implements Initializer<Boolean> {
// Register our uncaught exception handler.
JitsiMeetUncaughtExceptionHandler.register();
// Register activity lifecycle handler for the orientation locker module.
((Application) context).registerActivityLifecycleCallbacks(OrientationActivityLifecycle.getInstance());
return true;
}

View File

@ -31,7 +31,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.facebook.react.modules.core.PermissionListener;
import org.wonday.orientation.OrientationActivityLifecycle;
import org.jitsi.meet.sdk.log.JitsiMeetLogger;
import java.util.HashMap;
@ -104,7 +103,6 @@ public class JitsiMeetActivity extends AppCompatActivity
this.jitsiView = findViewById(R.id.jitsiView);
registerForBroadcastMessages();
registerActivityLifecycleCallbacks(OrientationActivityLifecycle.getInstance());
if (!extraInitialize()) {
initialize();