1

This is for a jailbreak tweak, so it doesn't matter that I need to use private frameworks.

How can you change the volume of the device and how can you turn off silent mode?

If there is an easier way to play a sound at a specific volume and will always play regardless of silent mode is on or off, this will actually be better.

4

2 回答 2

1

You can change the volume using the VolumeControl class:

static void setVolume(float volume) {
    VolumeControl *volumeControl = [VolumeControl sharedVolumeControl];
    [volumeControl setMediaVolume:volume];
}

I don't know how to toggle the silent switch yet.

于 2012-07-30T02:17:27.930 回答
0

I haven't tried this out, so no guarantees regarding it functioning properly ...

but just by looking at the dumped header, I would try this for turning silent mode on or off:

VolumeControl *volumeControl = [VolumeControl sharedVolumeControl];
[volumeControl toggleMute];

let me know if it works for you ...

于 2012-07-30T06:49:22.590 回答