Skip to content

Commit e09438f

Browse files
author
Quoc Khanh
committed
fix background
1 parent 7240ecb commit e09438f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ public void dismiss() {
6363

6464
@ReactMethod
6565
public void backToForeground() {
66-
String packageName = reactContext.getApplicationContext().getPackageName();
67-
Intent focusIntent = reactContext.getPackageManager().getLaunchIntentForPackage(packageName).cloneFilter();
68-
Activity activity = reactContext.getCurrentActivity();
66+
Context context = getAppContext();
67+
String packageName = context.getApplicationContext().getPackageName();
68+
Intent focusIntent = context.getPackageManager().getLaunchIntentForPackage(packageName).cloneFilter();
69+
Activity activity = getCurrentActivity();
6970
boolean isOpened = activity != null;
7071
Log.d(TAG, "backToForeground, app isOpened ?" + (isOpened ? "true" : "false"));
7172

example/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ export function handleRemoteMessage(remoteMessage, isHeadless) {
7676
);
7777
DeviceEventEmitter.addListener('endCall', payload => {
7878
// End call action here
79+
console.log('endCall', payload);
7980
});
8081
DeviceEventEmitter.addListener('answerCall', payload => {
8182
// Start call action here
82-
IncomingCall.backToForeground();
83+
console.log('answerCall', payload);
84+
RNCallKeep.backToForeground();
8385
});
8486
}
8587
// Could also persist data here for later uses

0 commit comments

Comments
 (0)