diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java
index c102e5df7..5f4b6a7c7 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java
@@ -26,6 +26,8 @@ import android.support.v7.app.AppCompatActivity;
import java.net.URL;
+import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
+
/**
* Base Activity for applications integrating Jitsi Meet at a higher level. It
* contains all the required wiring between the JKConferenceView and
@@ -37,10 +39,13 @@ import java.net.URL;
* hooked to the React Native subsystem via proxy calls through the
* JKConferenceView static methods.
*/
-public class JitsiMeetActivity extends AppCompatActivity {
+public class JitsiMeetActivity
+ extends AppCompatActivity
+ implements DefaultHardwareBackBtnHandler {
+
/**
* The request code identifying requests for the permission to draw on top
- * of other apps. The value must be 16-bit and is arbitrarily chosen here.
+ * of other apps. The value must be 16-bit and is arbitrarily chosen here.
*/
private static final int OVERLAY_PERMISSION_REQUEST_CODE
= (int) (Math.random() * Short.MAX_VALUE);
@@ -128,6 +133,15 @@ public class JitsiMeetActivity extends AppCompatActivity {
}
}
+ /**
+ * This method is called if the JS part does not handle the physical back
+ * button press.
+ */
+ @Override
+ public void invokeDefaultOnBackPressed() {
+ super.onBackPressed();
+ }
+
/**
* {@inheritDoc}
*/
@@ -201,7 +215,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
- JitsiMeetView.onHostResume(this);
+ JitsiMeetView.onHostResume(this, this);
}
/**
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
index b6fe2af11..347b02dde 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
@@ -27,10 +27,12 @@ import android.support.annotation.Nullable;
import android.widget.FrameLayout;
import com.facebook.react.ReactInstanceManager;
+import com.facebook.react.ReactInstanceManagerBuilder;
import com.facebook.react.ReactRootView;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.common.LifecycleState;
+import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import java.net.URL;
import java.util.Arrays;
@@ -184,10 +186,14 @@ public class JitsiMeetView extends FrameLayout {
* Activity.onResume so we can do the required internal processing.
*
* @param activity - Activity being resumed.
+ * @param backHandler - a DefaultHardwareBackBtnHandler which
+ * will handle the back button press in case there's nothing to handle on
+ * the JS side.
*/
- public static void onHostResume(Activity activity) {
+ public static void onHostResume(Activity activity,
+ DefaultHardwareBackBtnHandler backHandler) {
if (reactInstanceManager != null) {
- reactInstanceManager.onHostResume(activity, null);
+ reactInstanceManager.onHostResume(activity, backHandler);
}
}