How to increase iPhone volume programmatically - iphone

In my app I have to play the siren sound on tapping the button, I can able to play it when ringer volume is set to some value, but my problem is when user kept their ringer volume to zero, how can I play it with maximum sound?

Officially you can't do this. As a smartphones user, I wouldn't appreciate to set my volume at 10% and have an app that rings at max volume.
You can however try to use Celestial.framework, but your application will be rejected from the App Store.

try this code ,it only work in device
[[MPMusicPlayerController applicationMusicPlayer] setVolume:setvalue];

Related

Iphone App auto volume

Is it possible to have an iphone app that:
Allows you to silence phone and automatically turn ringer back on after a set amount of time?
Or
Lowers ringer volume to 0 and then automatically turn ringer back up after a set amount of time?
Thanks, All answers will be appreciated
Check out this post:
How to programmatically silence the ringer or change the ringer tone on iOS5

Boost Volume in iOS

Hi I am using MPMoviePlayerController to play a movie in my app. My client wants to boost the audio of the movie that should be greater than iOS system max volume. How to achieve this?
It's impossible to boost volume higher than iOS default settings.
If your client wants louder audio in a video, get them to edit the video content and up the volume of the video's audio (in the case that their video sound is very low).
For example: http://www.youtube.com/watch?v=OvLgQ61wJS8
For iOS, the device user is in control of the volume, you cannot apply sound volume larger than their defined volume or any volume at all if the device is muted.

How do i set the iPod volume without affecting other sound levels?

I tried setting the iPod volume level before, but it affected the volume of my app, which uses MPMusicPlayer. Any solution to this?
If your app is playing music locally (not affecting the iPod app) you can use MPMusicPlayerController to create an application music player and then set the volume property to whatever you want.
MPMusicPlayerController Class Reference

want to build an alarm app in iphone

I want to build an alarm application for iphone. I want to ignore iphone device state and volume buttons state. I want to play sound anyhow in full volume and also want that user cant modify volume using iphone hardware buttons while sound is played. Does anybody know how to implement it? Please post the code here.......
Thankx in Advance.......
This is not possible (without jailbreaking).
You cannot force the iPhone to change its volume or intercept the hardware buttons. Also you cannot "ignore device state", as you cannot run background apps. So if your app is not running you can't execute any code

MPVolume on ipodtouch/iphone

i'm using the code of this link: http://blog.stormyprods.com/2008/09/proper-usage-of-mpvolumeview-class.html
it is working on an ipod touch, but NOT on iphones.
what can be the reason for that?
Two things:
I think iPhone OS 3.0 does a better job of syncing the MPVolumeView slider with changes to the system volume received from the buttons on side. So the workaround on that blog (listening for NSNotifications) may no longer be necessary.
On the iPhone, volume changes are contextual. If your app is currently playing sound, then hitting the volume buttons (or, presumably, MPVolumeView) affects the volume level of your app's audio. But if your app isn't producing sound, then you are just changing the ringer volume. This might explain why your current code works on touches, which don't have ringers.