5

Is there a way to reduce the volume of the ringer or change the ringer tone on iOS5?

I checked out the Celestial framework, but can't instantiate AVSystemController. :-(

I don't care if this get's the app rejected in the AppStore as it will never be submitted.

Charles
  • 50,943
  • 13
  • 104
  • 142
cfischer
  • 24,452
  • 37
  • 131
  • 214

2 Answers2

9

Yes. Use AVSystemController. You don't instantiate it. It's a singleton.

http://code.google.com/p/iphone-dev/source/browse/trunk/include/include/Celestial/AVSystemController.h?r=136

[[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:@"Ringtone"];
edc1591
  • 10,146
  • 6
  • 40
  • 63
  • Could you provide an example, please? – cfischer Feb 17 '12 at 09:35
  • I tried including the file you linked, but I get the following error: Undefined symbols for architecture i386: "_OBJC_CLASS_$_AVSystemController", referenced from: objc-class-ref in FRRViewController.o ld: symbol(s) not found for architecture i386 Besides, there's not setVolumeTo:forCategory: method in the linked file. – cfischer Feb 19 '12 at 17:46
  • It simply may not exist in the simulator — have you tested on device? You could use `[[NSClassFromString(@"AVSystemController") sharedAVSystemController]...` to produce code that works either way if that's the cause. – Tommy Feb 19 '12 at 19:17
  • 1
    You have to link against the Celestial framework. Or you can do what Tommy suggested if you want to avoid linking against it. – edc1591 Feb 19 '12 at 22:13
  • And `setVolumeTo:forCategory:` does exist. The file I linked to is old. Maybe from iOS 3. `setVolumeTo:forCategory:` is available in iOS 4 and 5 I think. – edc1591 Feb 19 '12 at 22:14
  • @tommy I had already tried what you suggested, but [[NSClassFromString(@"AVSystemController") sharedAVSystemController] always returns nil, both on the simulator and the device (iPhone 4 on iOS 5). – cfischer Feb 23 '12 at 09:09
  • @Fernando I have used that exact code, and it works fine. Also, it won't work on the simulator, only an actual device. – edc1591 Feb 23 '12 at 16:26
  • This approach is working well for me. Where can I find a list of supported categories though? So far I'm only aware of "Ringtone" and "UserInterfaceSoundEffects". – Ben Dowling Aug 28 '12 at 14:14
0

This might be what you are looking for: Override ringer volume in iPhone apps

Basically, you set the volume using AVAudioPlayer on the -(void)viewDidLoad method of the view you are displaying on

Community
  • 1
  • 1
JoeCortopassi
  • 5,083
  • 7
  • 37
  • 65