Skip to content

Commit 7230882

Browse files
committed
show full screen caller & answer video call phone locked
1 parent 72f6274 commit 7230882

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

android/src/main/java/com/ngs/react/RNTwilioVideo/TwilioVideoModule.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ private void internalAccept(VideoCallInvite invite, Integer notificationId) {
112112

113113
activeCall = new VideoCall(invite.getSession(), invite.getFrom("\n", null));
114114

115+
if (getReactApplicationContext().getCurrentActivity() != null) {
116+
Window window = getReactApplicationContext().getCurrentActivity().getWindow();
117+
getReactApplicationContext().getCurrentActivity().runOnUiThread(new Runnable() {
118+
@Override
119+
public void run() {
120+
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
121+
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
122+
};
123+
});
124+
}
125+
115126
WritableMap params = Arguments.createMap();
116127
for (Map.Entry<String, String> entry : invite.getData().entrySet()) {
117128
params.putString(entry.getKey(), entry.getValue());
@@ -254,12 +265,6 @@ private void handlePendingIntent(Intent intent, String event) {
254265
Log.d(TAG, "activeCallInvite: " + activeCallInvite.toString());
255266

256267
if (activeCallInvite != null) {
257-
if (getReactApplicationContext().getCurrentActivity() != null) {
258-
Window window = getReactApplicationContext().getCurrentActivity().getWindow();
259-
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
260-
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
261-
);
262-
}
263268
// send a JS event ONLY if the app's importance is FOREGROUND or SERVICE
264269
// at startup the app would try to fetch the activeIncoming calls
265270
int appImportance = callNotificationManager.getApplicationImportance(getReactApplicationContext());

0 commit comments

Comments
 (0)