fix(android) apply flags when launching activity from non-activity context

Check whether context is that of an Activity before launching the Jitsi Conference Activity. If context is not an activity context, apply flag FLAG_ACTIVITY_NEW_TASK to the Jitsi Activity Intent to ensure activity can launch without error.

This scenario would manifest when a user attempts to launch the Jitsi Actvity from a Widget... for example.

https://developer.android.com/about/versions/pie/android-9.0-changes-all#fant-required
This commit is contained in:
Jake Breen 2021-03-22 11:59:43 +00:00 committed by GitHub
parent f225ce886f
commit f3c1b8ac08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import com.facebook.react.modules.core.PermissionListener;
import org.jitsi.meet.sdk.log.JitsiMeetLogger;
import java.util.HashMap;
import android.app.Activity;
/**
* A base activity for SDK users to embed. It uses {@link JitsiMeetFragment} to do the heavy
@ -58,6 +59,9 @@ public class JitsiMeetActivity extends FragmentActivity
Intent intent = new Intent(context, JitsiMeetActivity.class);
intent.setAction(ACTION_JITSI_MEET_CONFERENCE);
intent.putExtra(JITSI_MEET_CONFERENCE_OPTIONS, options);
if (!(context instanceof Activity)) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
context.startActivity(intent);
}