question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeviceInfo.isHeadphonesConnected() always return false on Redmi 6

See original GitHub issue

Bug

I’m wondering if this is related to some kind of version incompatibility or just whether I can expect it to work - does it look like isHeadphonesConnected() should return true under these circumstances? Thanks very much!

Environment info

react-native info output:

    OS: macOS Mojave 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 26.63 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.3.1 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.4 => 0.61.4
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-rename: 2.4.1

Library version: 5.5.4

Steps To Reproduce

  1. Plug in wired headphones to Redmi 6 running Android 8
  2. run React Native application and log return value of DeviceInfo.isHeadphonesConnected()

Describe what you expected to happen:

  1. DeviceInfo.isHeadphonesConnected() to return true

Reproducible sample code

import DeviceInfo from 'react-native-device-info';

areHeadphonesConnected();

export const areHeadphonesConnected = () => {
  DeviceInfo.isHeadphonesConnected().then(enabled => {
    // true or false
    console.log('areHeadphonesConnected', enabled);
  })
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
CaptainJeffcommented, May 18, 2020

Yeah i actaully have already played aroudn with a few of hte suggestions that I have found on stackoverflow and continue to get false with different objective-c API’s

But i’m going to keep playing around and I’ll create a PR if I end up figuring it out

0reactions
mikehardycommented, Jul 18, 2020

No response from submitter

Read more comments on GitHub >

github_iconTop Results From Across the Web

DeviceInfo.isHeadphonesConnected() always return false on ...
DeviceInfo.isHeadphonesConnected() always return false on Redmi 6 #1009 ... run React Native application and log return value of DeviceInfo.
Read more >
react-native-device-info | Yarn - Package Manager
syncUniqueId(). This method is intended for iOS. This synchronizes uniqueId with IDFV or sets new a random string. On iOS it uses the...
Read more >
react-native-device-info/CHANGELOG.md - UNPKG
270, - fix: iOS isTablet was always returning false. 271, - fix: hasSystemFeatureSync incorrectly returned Promise. 272. 273, ## 4.0.1-beta.6.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found