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

'WiredHeadset' event not working on iOS #73

Open
mikesholiu opened this issue Mar 1, 2018 · 3 comments
Open

'WiredHeadset' event not working on iOS #73

mikesholiu opened this issue Mar 1, 2018 · 3 comments

Comments

@mikesholiu
Copy link

mikesholiu commented Mar 1, 2018

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)

@nppull
Copy link

nppull commented Jun 26, 2018

import { DeviceEventEmitter } from 'react-native';

DeviceEventEmitter.addListener('WiredHeadset', function (data) {
// --- do something with events
});

not working android ...

@whck6
Copy link
Contributor

whck6 commented Aug 1, 2018

same problem

@whck6
Copy link
Contributor

whck6 commented Aug 2, 2018

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:@{}]

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

3 participants