react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
897 stars 435 forks source link

Emulator Question #448

Open Asher978 opened 3 years ago

Asher978 commented 3 years ago

Is running the app on actual IOS device via XCODE considered running it on an emulator?

namnm commented 3 years ago

@Asher978 You run an app in device will always be different with simulator, no matter if you run via XCode UI or via react-native run-ios One of the main different is that on simulator you can not receive push notification, on real device you can. But remember that the environment settings of sandbox/production which can effect the push notification testing.

Asher978 commented 3 years ago

@Asher978 You run an app in device will always be different with simulator, no matter if you run via XCode UI or via react-native run-ios One of the main different is that on simulator you can not receive push notification, on real device you can. But remember that the environment settings of sandbox/production which can effect the push notification testing.

Does not make sense in what you are saying.

You can run the native app on an actual device with Firebase Push Notifications. I run it on my device all the time.

I was just wondering that running an app on an actual device via Xcode is considered running on an emulator?

Asher978 commented 3 years ago
if (isIOS && DeviceInfo.isEmulator()) {
    return <Text style={styles.container}>CallKeep doesn't work on iOS emulator</Text>;
}

Figured out the issue in the example. The above will always return true even on actual device as DeviceInfo.isEmulator() is a promise. That is why the if statement will return true even on actual device.

This will work instead:

const emulatorCheck = async () => {
    const isEmulator = await DeviceInfo.isEmulator();

    if (isIOS && isEmulator) {
      return (
        <Text style={styles.container}>
          CallKeep doesn't work on iOS emulator
        </Text>
      );
    }
  };
  emulatorCheck();
namnm commented 3 years ago

@Asher978 Ok, I never use firebase for ios, only apns directly. Anyway. So you found the issue in your code, good to close this issue?

Asher978 commented 3 years ago

Still can not get the incoming call UI shown on the device.

I followed the example. Any suggestions?

namnm commented 3 years ago

@Asher978 To receive and display call, we must use voip apns token. Have you configured your firebase with that token? As I mentioned, we never use firebase for ios, just plain apns. https://github.com/react-native-webrtc/react-native-voip-push-notification#important-note

usamaabutt commented 3 years ago

Hello guys, I am having an issue regarding callkeep for android could you help me in this issue, @namnm @Asher978 @c960657 @LinusU https://github.com/react-native-webrtc/react-native-callkeep/issues/450

Asher978 commented 3 years ago

@Asher978 To receive and display call, we must use voip apns token. Have you configured your firebase with that token? As I mentioned, we never use firebase for ios, just plain apns. https://github.com/react-native-webrtc/react-native-voip-push-notification#important-note

that was precisely the missing the piece. Appreciate the pointer here ...

You can close this

Asher978 commented 3 years ago

@Asher978 To receive and display call, we must use voip apns token. Have you configured your firebase with that token? As I mentioned, we never use firebase for ios, just plain apns. https://github.com/react-native-webrtc/react-native-voip-push-notification#important-note

Is it odd that I have success with using FCM on server side (firebase-admin messaging) to push a background notification to the IOS Device using an APN token. I am able to display the CallKit Incoming Call UI in background, foreground and app in killed state. As the docs stated to use VOIP push for IOS and FCM for Android. Just want to make sure that using FCM on IOS side is ok to deliver background notif to awake callkit

namnm commented 3 years ago

@Asher978 Have you tried to call RNCallKeep.displayIncomingCall inside of your ios background PN handler? Does it work? On our side, we use both both voip and regular PN: voip for call, regular for others like chat, notify...