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)
pull/12356/head
Saúl Ibarra Corretgé 2 years ago committed by Saúl Ibarra Corretgé
parent abdc5123eb
commit 768cca6162
  1. 6
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiInitializer.java
  2. 2
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java

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

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

Loading…
Cancel
Save