Skip to content

Commit 18bf304

Browse files
author
Quoc Khanh
committed
fix background
1 parent e09438f commit 18bf304

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

android/src/main/java/com/incomingcall/IncomingCallModule.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.os.Bundle;
55
import android.app.Activity;
66
import android.view.WindowManager;
7+
import android.content.Context;
8+
import android.util.Log;
79

810
import com.facebook.react.bridge.ReactApplicationContext;
911
import com.facebook.react.bridge.ReactContextBaseJavaModule;
@@ -16,6 +18,8 @@ public class IncomingCallModule extends ReactContextBaseJavaModule {
1618
public static ReactApplicationContext reactContext;
1719
public static Activity mainActivity;
1820

21+
private static final String TAG = "RNIC:IncomingCallModule";
22+
1923
public IncomingCallModule(ReactApplicationContext context) {
2024
super(context);
2125
reactContext = context;
@@ -61,6 +65,10 @@ public void dismiss() {
6165
assert activity != null;
6266
}
6367

68+
private Context getAppContext() {
69+
return this.reactContext.getApplicationContext();
70+
}
71+
6472
@ReactMethod
6573
public void backToForeground() {
6674
Context context = getAppContext();

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function handleRemoteMessage(remoteMessage, isHeadless) {
8181
DeviceEventEmitter.addListener('answerCall', payload => {
8282
// Start call action here
8383
console.log('answerCall', payload);
84-
RNCallKeep.backToForeground();
84+
IncomingCall.backToForeground();
8585
});
8686
}
8787
// Could also persist data here for later uses

example/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5443,7 +5443,7 @@ react-native-bootsplash@^2.2.4:
54435443

54445444
"react-native-incoming-call@git+https://github.com/bkdev98/react-native-incoming-call.git#v2":
54455445
version "2.0.0"
5446-
resolved "git+https://github.com/bkdev98/react-native-incoming-call.git#490566d8f3b75ea0f895e9c318f6e492249f4d2e"
5446+
resolved "git+https://github.com/bkdev98/react-native-incoming-call.git#e09438f3d2af7d2f346aa77fa65c572f6f699a3d"
54475447

54485448
54495449
version "0.62.2"

0 commit comments

Comments
 (0)