IOS Volume is always 0
Hello there, I'm working on an app and cannot get the package to work RN version is 62.2
I added and linked the library correctly, but whenever I call the function
SystemSettings.getVolume('system').then(data => console.log(data) I get the same amount all the time, even when I changed the volume on the simulator.
Anyone had the same issue ?
Okay I found out that it doesn't work on Simulator - only on Physical device - please add it to the docummentation. If you don't have time - i'll make a PR :)
hello dev, first of all, thank you for your hard work. @Karniej Unfortunatelly I also have this issue:
All of these return 0 on IOS:
const volumeMusic = await this.getSystemSettingsVolume('music');
const volumeSystem = await this.getSystemSettingsVolume('system');
const volumeCall = await this.getSystemSettingsVolume('call');
const volumeAlarm = await this.getSystemSettingsVolume('alarm');
const volumeNotification = await this.getSystemSettingsVolume('notification');
const volumeRing = await this.getSystemSettingsVolume('ring');
but when using listener, IOS returns data.value that has expected value
type TSystemSettingsVolumeListenerData = {
alarm: number,
call: number,
music: number,
notification: number,
ring: number,
system: number,
value: number,
};
SystemSetting.addVolumeListener((data: TSystemSettingsVolumeListenerData) => {
// IOS does not return anything but data.value
// Android lists TSystemSettingsVolumeListenerData
const volume = isIos ? data.value : data.music; // workaround
this._setAppVolumeLevel(volume);
});
@LeDanielH I recommend trying out on a physical device -then you can test it out correctly. :)
@LeDanielH this library only works with physical devices. A simulator always returns 0 for volume and a device returns the correct volume level.
I have a similar problem and to me it seems like the entire library isn't working for me.
I tested it on a device and installed the library normally with npm i
My Code is as followed ` componentDidMount(): void { this.interval = setInterval(this.checkVolume, 500); }
checkVolume() {
SystemSetting.getVolume('music').then((checkedVolume)=>{
this.setState({musicVolume: checkedVolume});
});
SystemSetting.getVolume('system').then((checkedVolume)=>{
this.setState({systemVolume: checkedVolume});
});
SystemSetting.getVolume('call').then((checkedVolume)=>{
this.setState({callVolume: checkedVolume});
});
SystemSetting.getVolume('alarm').then((checkedVolume)=>{
this.setState({alarmVolume: checkedVolume});
});
SystemSetting.getVolume('notification').then((checkedVolume)=>{
this.setState({notificationVolume: checkedVolume});
});
SystemSetting.getVolume('ring').then((checkedVolume)=>{
this.setState({ringVolume: checkedVolume});
});
}
`
No matter how much I change the volume on my device, it always stays 0?