react-native-incall-manager
react-native-incall-manager copied to clipboard
'WiredHeadset' event not working on iOS
I'm using the below pattern (1.) per the docs, but the 'WiredHeadset' event doesn't seem to be firing on iOS. I also tried with NativeEventEmitter (doing this by using NativeModules to get the InCallManager then wrapping it in NativeEventEmitter, see 2.). I'm on version 0.53 of RN.
import { DeviceEventEmitter } from 'react-native';
DeviceEventEmitter.addListener('WiredHeadset', function (data) {
// --- do something with events
});
const InCallManagerEvent = new NativeEventEmitter(NativeModules.InCallManager)
import { DeviceEventEmitter } from 'react-native';
DeviceEventEmitter.addListener('WiredHeadset', function (data) { // --- do something with events });
not working android ...
same problem
i'm resolve
import {
NativeModules,
NativeEventEmitter,
} from 'react-native';
const nativeBridge = NativeModules.InCallManager;
const NativeModule = new NativeEventEmitter(nativeBridge);
this.wiredHeadsetListener = NativeModule.addListener('WiredHeadset', (data) => {
// do something
});
and i found native code return the array, not like subscribe on README, so not work so for, should be object of [self sendEventWithName:@"WiredHeadset" body:@{}]