1.3.0 • Published 4 years ago

react-native-headphone-detection v1.3.0

Weekly downloads
237
License
MIT
Repository
github
Last release
4 years ago

react-native-headphone-detection

Getting started

$ yarn add react-native-headphone-detection

Mostly automatic installation

  • For react-native 0.60+:

    $ cd ios && pod install && cd ..
  • For previous versions:

    $ react-native link react-native-headphone-detection

Add permissions for android:

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH" />

Usage

import HeadphoneDetection from 'react-native-headphone-detection';

// Function
HeadphoneDetection.isAudioDeviceConnected().then(console.log);
/*
  Output:
  {
    audioJack: boolean,
    bluetooth: boolean,
  }
*/

// You can also use it as an event listener
HeadphoneDetection.addListener(console.log);

// Don't forget to remove the listener!
if (HeadphoneDetection.remove) { // The remove is not necessary on Android
  HeadphoneDetection.remove();
}
1.3.0

4 years ago

1.2.0

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago