Events don't trigger to me
Opened this issue · 13 comments
Hello, amazing plugin but I have to face two problems.
So far the one that really annoys me is that I cannot catch any event with this code:
I'm on IOS 13.6, I tried with different phones but same OS.
Is there something I am missing ?
Anyone has been able to catch events on IOS13 ?
Thanks a lot
document.addEventListener(
"deviceready",
() => {
cordova.plugins.CordovaCall.on("receiveCall", () => {
console.log("has received an incoming call");
this.event = `${this.uid} ${this.nickname} has received an incoming call`;
});
})
now I get it!
Because I use another 2 audio plugin IOSRTC and cordova-plugin media. I had to change in CordovaCall.m the setupAudioSession
- (void)setupAudioSession
{
@try {
AVAudioSession *sessionInstance = [AVAudioSession sharedInstance];
[sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionMixWithOthers |
AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
[sessionInstance setMode:AVAudioSessionModeVoiceChat error:nil];
NSTimeInterval bufferDuration = .005;
[sessionInstance setPreferredIOBufferDuration:bufferDuration error:nil];
[sessionInstance setPreferredSampleRate:44100 error:nil];
NSLog(@"Configuring Audio");
}
@catch (NSException *exception) {
NSLog(@"Unknown error returned from setupAudioSession");
}
return;
}
what does the audio session has to do with the events?
it just was crashing the whole thing because I use other plugins which needs to access the audio session and this one takes control over it, any press on speaker or mute is accessing the audio session.
but you were talking about the events in the first post on this issue, you weren't able to catch them...
Yes, because the plugin was crashing somehow. as soon as I pressed a button from the standby screen
weird... for me it's not crashing but i get this message:
[Application] -[AppDelegate application:continueUserActivity:restorationHandler:] <NSUserActivity: 0x281c02440> has an interaction attached but it is not handled
when i click a call in recents. that should be the sendCall
event
the method receiveCallFromRecents:
in CordovaCall.m
doesn't seem to broadcast anything to cordova in order to emit an event back to javascript...
yeah this thing is not super reliable, there's a fork available with a bit more maintenance.
where? :) currently there are 65... :)
yeah, so after debugging a little bit i found out why the events aren't working. turns out there's a conflict (in my case with the deeplinks plugin) both using the same delegate method - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
i'll swizzle the method in cordova call's delegate so i can have both
well, my fork is not for this plugin but for one containing both cordova call and voip pushkit. the delegate i modified could be applied to this plugin alone though.
you can find it here