I want to reduce the ringing volume of iPhone programmatically, I came to know that it is possible with AVSystemController
, But I know, it is a private method. If I use it, will apple reject the app or please suggest me the alternative way
Asked
Active
Viewed 2,430 times
2

sunkehappy
- 8,970
- 5
- 44
- 65

KishoreThindaak
- 391
- 2
- 4
- 14
-
Did you find a solution for this? I am facing a similar issue. – ScarletWitch Apr 10 '14 at 14:28
5 Answers
4
- (void) setSystemVolumeLevelTo:(float)newVolumeLevel
{
Class avSystemControllerClass = NSClassFromString(@"AVSystemController");
id avSystemControllerInstance = [avSystemControllerClass performSelector:@selector(sharedAVSystemController)];
NSString *soundCategory = @"Ringtone";
NSInvocation *volumeInvocation = [NSInvocation invocationWithMethodSignature:
[avSystemControllerClass instanceMethodSignatureForSelector:
@selector(setVolumeTo:forCategory:)]];
[volumeInvocation setTarget:avSystemControllerInstance];
[volumeInvocation setSelector:@selector(setVolumeTo:forCategory:)];
[volumeInvocation setArgument:&newVolumeLevel atIndex:2];
[volumeInvocation setArgument:&soundCategory atIndex:3];
[volumeInvocation invoke];
}

Jim Clermonts
- 1,694
- 8
- 39
- 94
0
Using any kind of private method there is the change of Apple rejecting your app. Since the public iOS SDk does not allow you to change the ringer volume, you will not be able to this from your app.

rckoenes
- 69,092
- 8
- 134
- 166
0
Possible yes, apple will reject it. Here is the link that will tell you how to do this.[link2
Update:
[[MPMusicPlayerController applicationMusicPlayer] setVolume:setvalue];
Check theselink link also. You cannot change the ringer volume programmatically.

Community
- 1
- 1

iPhone Programmatically
- 1,211
- 2
- 22
- 54
-
the alternate link says it is for app music player but I want to reduce the ringer volume – KishoreThindaak Jan 16 '14 at 09:44
-
@user2634244 look at the question what that guy has used to increase/decrease the volume. His question is your answer. – iPhone Programmatically Jan 16 '14 at 10:43
-
@user2634244 As far i know and understood after doing r&d is that you can not change the ringer volume programmaticaly, but you can set it at some level programmatically. Please check my updated answer. – iPhone Programmatically Jan 16 '14 at 10:57
-
Still that answer shows setting the volume of the player that plays his sound from his own app, but I want change ringer volume which is different – KishoreThindaak Jan 16 '14 at 11:01
-1
you can use AVAudioPlayer and MPVolumeView for manage valume also please refer this link: How to implement a volume key shutter for iPhone?
-
The question is about the phone ringer volume not the audio playback volume. – rckoenes Jan 16 '14 at 09:04
-
-
Yes I did, it a talking about a hack to detect the pressing of the plus volume button. But this question is about programmatically change the ringer volume, not the audio playback volume. – rckoenes Jan 16 '14 at 09:15
-2
Try this code
float value = 0.5;//this should be between 0.0 to 1.0
[[MPMusicPlayerController applicationMusicPlayer] setVolume: value];

Deepak Bharati
- 280
- 2
- 13