Skip to content

Commit ea8fe8c

Browse files
author
Quoc Khanh
committed
fix background
1 parent 40348f0 commit ea8fe8c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.facebook.react.bridge.Callback;
1414
import com.facebook.react.bridge.Promise;
1515
import com.facebook.react.bridge.WritableMap;
16+
import com.facebook.react.bridge.WritableNativeMap;
1617

1718
public class IncomingCallModule extends ReactContextBaseJavaModule {
1819

example/App.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ export function handleRemoteMessage(remoteMessage, isHeadless) {
8181
DeviceEventEmitter.addListener('answerCall', payload => {
8282
// Start call action here
8383
console.log('answerCall', payload);
84-
IncomingCall.backToForeground();
84+
if (payload.isHeadless) {
85+
IncomingCall.openAppFromHeadlessMode(payload.uuid);
86+
} else {
87+
IncomingCall.backToForeground();
88+
}
8589
});
8690
}
8791
// Could also persist data here for later uses
@@ -121,9 +125,8 @@ const App = () => {
121125
}, []);
122126

123127
async function handleIncomingCall() {
124-
const launchPayload = await IncomingCall.getLaunchParameters();
125-
console.log('launchParameters', launchPayload);
126-
IncomingCall.clearLaunchParameters();
128+
const launchPayload = await IncomingCall.getExtrasFromHeadlessMode();
129+
console.log('getExtrasFromHeadlessMode', launchPayload);
127130
if (launchPayload) {
128131
// Start call here
129132
setCallPayload(launchPayload);

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#18bf304653dd5ded1b080c984bd01deddc1e2554"
5446+
resolved "git+https://github.com/bkdev98/react-native-incoming-call.git#40348f0b266a19ea64d47d0d31e6859e19b37d18"
54475447

54485448
54495449
version "0.62.2"

0 commit comments

Comments
 (0)