New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-headphone-detection

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-headphone-detection

React Native headphone detection, both audio jack and bluetooth devices!

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by6.51%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 01 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc