Closed Nadimkhan120 closed 7 months ago
Hi, I would want Hirbod to confirm. But in theory, when the app is backgrounded the normal app js won't run, you should not be able to unless you use some sort of background task to do that.
What is your use case?
@Nasseratic, your assumption is correct. React Native Apps that have been sent to the background might continue to work for 60 seconds up to three minutes. Thus, events can be received while the app is backgrounded, but only for a very short period. Typically, music sessions are also lost when the app is in the background (unless a background music service has been registered). Therefore, there isn't a consistent method, and I believe this is beyond the scope of this package.
useEffect(() => { const volumeListener = VolumeManager.addVolumeListener(result => { console.log('Volume changed:', result); });
return () => {
volumeListener.remove();
};
}, []);
@hirbod @Nasseratic addVolumeListener is not triggering when screen locks and resume back ... the addVolumeListener wont trigger if we screen locks and resume?
@suseendhar check this issue for a solution. The main reason is that the audio session is lost:
https://github.com/hirbod/react-native-volume-manager/issues/21
@hirbod Thanks after adding this line VolumeManager.enable(true) in app state active it is working
hi @hirbod can we listen volume changes when the app is background or quit state?