didReceiveStartCallAction is not working when app on quit state
Bug report
-
[x] I've checked the example to reproduce the issue.
-
Reproduced on:
-
[ ] Android
-
[x] iOS
Description
didReceiveStartCallAction is not working when app on quit state but working on app on background.
Steps to Reproduce
INFO PLIST
```
AppDelegate.m
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler { return [RNCallKeep application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; }
in js
useEffect(() => { RNCallKeep.addEventListener('didReceiveStartCallAction', (event) => { console.log('didReceiveStartCallAction', event); }); }, []);
## Versions
- Callkeep:4.3.1
- React Native:0.66.4
- iOS:15.3
- Android:
- Phone model: iPhone 13 mini
## Logs
2022-02-25 22:43:19.177460+0300 teleconn[13482:6301156] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x280d8ee00> (Domain: group.com.supernova.teleconn.onesignal, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
flipper: FlipperClient::addPlugin Inspector
flipper: FlipperClient::addPlugin Preferences
flipper: FlipperClient::addPlugin React
2022-02-25 22:43:19.516583+0300 teleconn[13482:6301353] [quic] quic_packet_parser_inner [C1.1.1:2] [-0188779de18c1932d289219def8c17d4aabff3f5] SH fixed bit is zero
flipper: FlipperClient::addPlugin Network
2022-02-25 22:43:19.816869+0300 teleconn[13482:6301156] [RNCallKeep][setup] options = {
appName = Teleconn;
imageName = "teleconn.png";
maximumCallGroups = 1;
maximumCallsPerCallGroup = 1;
ringtoneSound = "teleconn.mp3";
supportsVideo = 1;
}
2022-02-25 22:43:19.816953+0300 teleconn[13482:6301156] [RNCallKeep][getProviderConfiguration]
2022-02-25 22:43:20.002819+0300 teleconn[13482:6301156] [native] [RNVoipPushNotificationManager] voipRegistration enter
2022-02-25 22:43:20.003742+0300 teleconn[13482:6301156] [native] Running application teleconn ({
initialProps = {
};
rootTag = 1;
})
2022-02-25 22:43:20.016679+0300 teleconn[13482:6301350] 8.11.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add FirebaseApp.configure() to your application initialization. This can be done in in the App Delegate's application(_:didFinishLaunchingWithOptions:)(or the@main` struct's initializer in SwiftUI). Read more: https://goo.gl/ctyzm8.
2022-02-25 22:43:20.023983+0300 teleconn[13482:6301353] 8.11.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2022-02-25 22:43:20.041148+0300 teleconn[13482:6301156] [RNCallKeep][init]
2022-02-25 22:43:20.084460+0300 teleconn[13482:6301156] [native] [RNVoipPushNotificationManager] didUpdatePushCredentials credentials.token = {length = 32, bytes = 0xf852756f 7094bb76 20a1e940 0ee749f8 ... c1c948df dca4a655 }, type = PKPushTypeVoIP
2022-02-25 22:43:20.094409+0300 teleconn[13482:6301358] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
2022-02-25 22:43:20.130825+0300 teleconn[13482:6301373] [quic] quic_packet_parser_inner [C7.1.1:2] [-015da77873360621955cf178773638cfafa647cf] SH fixed bit is zero
2022-02-25 22:43:20.423093+0300 teleconn[13482:6301346] Request <OSRequestRegisterUser: 0x282d2db60> success result {
id = "4f0d82ac-9672-11ec-bf10-aee3d06b57a3";
success = 1;
}
2022-02-25 22:43:27.314733+0300 teleconn[13482:6301358] [connection] nw_socket_handle_socket_event [C9:1] Socket SO_ERROR [61: Connection refused]
2022-02-25 22:43:27.314857+0300 teleconn[13482:6301373] [connection] nw_connection_get_connected_socket [C9] Client called nw_connection_get_connected_socket on unconnected nw_connection
2022-02-25 22:43:27.314917+0300 teleconn[13482:6301373] TCP Conn 0x2814894a0 Failed : error 0:61 [61]
2022-02-25 22:43:27.823426+0300 teleconn[13482:6301359] RNInCallManager.init(): initialized
2022-02-25 22:43:27.824523+0300 teleconn[13482:6301353] RNInCallManager._checkRecordPermission(): recordPermission=undetermined
2022-02-25 22:43:27.936151+0300 teleconn[13482:6301358] RNInCallManager._checkCameraPermission(): using iOS7 api. cameraPermission=undetermined
2022-02-25 22:43:27.946057+0300 teleconn[13482:6301156] -[RNFBMessagingModule signalBackgroundMessageHandlerSet] [Line 102] signalBackgroundMessageHandlerSet called
2022-02-25 22:43:27.946084+0300 teleconn[13482:6301156] -[RNFBMessagingAppDelegate signalBackgroundMessageHandlerSet] [Line 74] signalBackgroundMessageHandlerSet sharedInstance.backgroundMessageHandlerSet was NO
2022-02-25 22:43:27.946229+0300 teleconn[13482:6301358] VERBOSE: setAppId(id) called with appId: 6efe21d8-cc58-4bb2-95fc-e24fef5626c3!
2022-02-25 22:43:27.946250+0300 teleconn[13482:6301358] VERBOSE: setAppId(id) finished, checking if launchOptions has been set before proceeding...!
2022-02-25 22:43:27.946264+0300 teleconn[13482:6301358] VERBOSE: setAppId(id) successful and launchOptions are set, initializing OneSignal...
2022-02-25 22:43:27.947142+0300 teleconn[13482:6301358] VERBOSE: registerForPushNotifications Called:waitingForApnsResponse: 0
2022-02-25 22:43:27.947250+0300 teleconn[13482:6301358] VERBOSE: Firing registerForRemoteNotifications
2022-02-25 22:43:27.947303+0300 teleconn[13482:6301156] VERBOSE: oneSignalDidRegisterForRemoteNotifications:deviceToken:
2022-02-25 22:43:27.947340+0300 teleconn[13482:6301156] INFO: Device Registered with Apple: 1d6ae92fa9c76312a6c88a690a21e9e53f3f5417f4702905582ebfd531c7a4dd
2022-02-25 22:43:27.947379+0300 teleconn[13482:6301156] VERBOSE: updateDeviceToken:onSuccess:onFailure:
2022-02-25 22:43:27.947379+0300 teleconn[13482:6301358] VERBOSE: registerUser:waitingForApnsResponse: 1
2022-02-25 22:43:27.947406+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:waitingForOneSReg: 0
2022-02-25 22:43:27.947422+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isImmediatePlayerCreateOrOnSession: 0
2022-02-25 22:43:27.947437+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isOnSessionSuccessfulForCurrentState: 1
2022-02-25 22:43:27.947567+0300 teleconn[13482:6301358] VERBOSE: registerUser:initializationTime: 2022-02-25 19:43:19 +0000
2022-02-25 22:43:27.947603+0300 teleconn[13482:6301358] VERBOSE: registerUserNow
2022-02-25 22:43:27.947670+0300 teleconn[13482:6301156] VERBOSE: registerUserInternal
2022-02-25 22:43:27.947671+0300 teleconn[13482:6301359] [javascript] Running "teleconn" with {"rootTag":1,"initialProps":{}}
2022-02-25 22:43:27.947710+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:waitingForOneSReg: 0
2022-02-25 22:43:27.947730+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isImmediatePlayerCreateOrOnSession: 0
2022-02-25 22:43:27.947776+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isOnSessionSuccessfulForCurrentState: 1
2022-02-25 22:43:27.956882+0300 teleconn[13482:6301156] VERBOSE: updateNotificationTypes called: 15
2022-02-25 22:43:27.958057+0300 teleconn[13482:6301156] VERBOSE: Firing registerForRemoteNotifications
2022-02-25 22:43:27.958076+0300 teleconn[13482:6301156] VERBOSE: startedRegister: 1
2022-02-25 22:43:27.958103+0300 teleconn[13482:6301156] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2022-02-25 22:43:27.959104+0300 teleconn[13482:6301156] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2022-02-25 22:43:27.960090+0300 teleconn[13482:6301156] VERBOSE: oneSignalDidRegisterForRemoteNotifications:deviceToken:
2022-02-25 22:43:27.960124+0300 teleconn[13482:6301156] INFO: Device Registered with Apple: 1d6ae92fa9c76312a6c88a690a21e9e53f3f5417f4702905582ebfd531c7a4dd
2022-02-25 22:43:27.960151+0300 teleconn[13482:6301156] VERBOSE: updateDeviceToken:onSuccess:onFailure:
2022-02-25 22:43:27.960176+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:waitingForOneSReg: 0
2022-02-25 22:43:27.960190+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isImmediatePlayerCreateOrOnSession: 0
2022-02-25 22:43:27.960203+0300 teleconn[13482:6301156] VERBOSE: shouldRegisterNow:isOnSessionSuccessfulForCurrentState: 1
2022-02-25 22:43:28.028409+0300 teleconn[13482:6301156] [] nehelper sent invalid result code [1] for Wi-Fi information request
2022-02-25 22:43:28.028939+0300 teleconn[13482:6301156] [] nehelper sent invalid result code [1] for Wi-Fi information request
2022-02-25 22:43:28.029632+0300 teleconn[13482:6301156] [] nehelper sent invalid result code [1] for Wi-Fi information request
2022-02-25 22:43:28.030160+0300 teleconn[13482:6301156] [] nehelper sent invalid result code [1] for Wi-Fi information request
2022-02-25 22:43:28.130219+0300 teleconn[13482:6301372] [quic] quic_crypto_session_state_serialize [C14.1.1:2] [-0715fe3470c88dc3] TLS ticket does not fit (6813 > 6144)
2022-02-25 22:43:28.130262+0300 teleconn[13482:6301372] [quic] quic_crypto_session_state_serialize [C14.1.1:2] [-0715fe3470c88dc3] TLS ticket does not fit (6813 > 6144)
2022-02-25 22:43:28.324770+0300 teleconn[13482:6301351] GTMSessionFetcher invoking fetch callbacks, data {length = 2125, bytes = 0x7b0a2020 22616363 6573735f 746f6b65 ... 39383931 220a7d0a }, error (null)
2022-02-25 22:43:28.451400+0300 teleconn[13482:6301346] [native] Manifest does not exist - creating a new one.
(null) 2022-02-25 22:43:28.582179+0300 teleconn[13482:6301156] [native] [RNVoipPushNotificationManager] voipRegistration is already registered. return _lastVoipToken = f852756f7094bb7620a1e9400ee749f8fcc3371a49bb9ec2c1c948dfdca4a655 2022-02-25 22:43:28.608878+0300 teleconn[13482:6301353] [quic] quic_packet_parser_inner [C20.1.1:2] [-0125cf117267aa87092499117567a6da7ce3997d] SH fixed bit is zero 2022-02-25 22:43:28.620891+0300 teleconn[13482:6301424] GTMSessionFetcher invoking fetch callbacks, data {length = 2125, bytes = 0x7b0a2020 22616363 6573735f 746f6b65 ... 39383931 220a7d0a }, error (null) 2022-02-25 22:43:28.622355+0300 teleconn[13482:6301424] [tcp] tcp_output [C17.1.1:3] flags=[R.] seq=4291553237, ack=2000572386, win=2047 state=CLOSED rcv_nxt=2000572386, snd_una=4291553174 2022-02-25 22:43:28.788309+0300 teleconn[13482:6301156] [native] [RNVoipPushNotificationManager] voipRegistration is already registered. return _lastVoipToken = f852756f7094bb7620a1e9400ee749f8fcc3371a49bb9ec2c1c948dfdca4a655 2022-02-25 22:43:34.401003+0300 teleconn[13482:6301156] VERBOSE: application/scene willResignActive 2022-02-25 22:43:34.401205+0300 teleconn[13482:6301156] DEBUG: Application Backgrounded started 2022-02-25 22:43:34.402707+0300 teleconn[13482:6301156] DEBUG: TimeProcessor <OSUnattributedFocusTimeProcessor: 0x282499b60> for session attributed 0 2022-02-25 22:43:34.402822+0300 teleconn[13482:6301156] DEBUG: sendOnFocusCall unattributed with totalTimeActive 42.606748 2022-02-25 22:43:34.402881+0300 teleconn[13482:6301156] DEBUG: OSBaseFocusTimeProcessor hasMinSyncTime getMinSessionTime: 60 activeTime: 42.606748 2022-02-25 22:43:34.402937+0300 teleconn[13482:6301156] DEBUG: unattributed influence saveUnsentActiveTime 42.606748 2022-02-25 22:43:35.012967+0300 teleconn[13482:6301156] VERBOSE: application/scene didEnterBackground 2022-02-25 22:43:35.282889+0300 teleconn[13482:6301156] [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance. 2022-02-25 22:43:35.291473+0300 teleconn[13482:6301156] VERBOSE: application/scene didEnterBackground Message from debugger: Terminated due to signal 9
You can't expect to have this event handler work when initialized inside a react functional component. React Native internally detatches a lot of processing for these when the app isn't in foreground.
You need to listen for these events in a global scope created directly from index.js.
Any guide on how to do this?
You can call the method getInitialEvents() when your app opens and check if the event didReceiveStartCallAction is there.