Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events don't trigger to me #105

Open
numerized opened this issue Jul 30, 2020 · 13 comments
Open

Events don't trigger to me #105

numerized opened this issue Jul 30, 2020 · 13 comments

Comments

@numerized
Copy link

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`;
        });

})
@numerized
Copy link
Author

numerized commented Sep 3, 2020

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;
}

@toriqo
Copy link

toriqo commented Oct 20, 2020

what does the audio session has to do with the events?

@numerized
Copy link
Author

numerized commented Oct 20, 2020

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.

@toriqo
Copy link

toriqo commented Oct 20, 2020

but you were talking about the events in the first post on this issue, you weren't able to catch them...

@numerized
Copy link
Author

Yes, because the plugin was crashing somehow. as soon as I pressed a button from the standby screen

@toriqo
Copy link

toriqo commented Oct 20, 2020

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

@toriqo
Copy link

toriqo commented Oct 20, 2020

the method receiveCallFromRecents: in CordovaCall.m doesn't seem to broadcast anything to cordova in order to emit an event back to javascript...

@numerized
Copy link
Author

yeah this thing is not super reliable, there's a fork available with a bit more maintenance.

@toriqo
Copy link

toriqo commented Oct 20, 2020

where? :) currently there are 65... :)

@toriqo
Copy link

toriqo commented Oct 20, 2020

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

@numerized
Copy link
Author

numerized commented Oct 20, 2020 via email

@toriqo
Copy link

toriqo commented Oct 20, 2020

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

@numerized
Copy link
Author

numerized commented Oct 20, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants