hirbod / react-native-volume-manager

React Native module which adds the ability to change the system volume on iOS and Android, listen to volume changes and supress the native volume UI to build your own volume slider or UX. It can listen to iOS mute switch and ringer mode changes on Android (and let you set the ringer mode)
MIT License
216 stars 13 forks source link

Volume listener doesn't work #16

Closed therealtgd closed 10 months ago

therealtgd commented 10 months ago

I've installed the library, ran pod install and added the volume listener, but nothing gets logged out to the console when the system volume changes. Im running the app on iOS 16.1 in XCode Simulator.

Below is the code for the volume listener.

  useEffect(() => {
    const volumeListener = VolumeManager.addVolumeListener((result) => {
      console.log(result.volume);
      setVolume(result.volume);
    });

    return () => volumeListener.remove();
  }, []);
hirbod commented 10 months ago

This Library doesn't work inside an iOS Simulator. You need to test on a real device. https://github.com/hirbod/react-native-volume-manager#simulators--emulators

therealtgd commented 10 months ago

This Library doesn't work inside an iOS Simulator. You need to test on a real device. https://github.com/hirbod/react-native-volume-manager#simulators--emulators

Oh, my bad. Thank you for the info.