I have stuck in a problem that in my alarm application for that i m creating a local notification and in my app there is a vibration on/off button when user on the vibration at that time only iPhone should vibrate sound will not come and when user off the vibration at that time only iPhone sound should come not vibrate. Please help me to solve this problem.
Asked
Active
Viewed 6,395 times
2 Answers
2
Try this code.
if(isVibrationButtonOn)
{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
Dont forget to import
AudioToolbox/AudioToolbox.h
Edit: In case of Local notification and vibration, You can refer the following discussions.

Community
- 1
- 1

Adarsh V C
- 2,314
- 1
- 20
- 37
-
1In case of notification, if app is in background then it will behave according to the user settings. – Adarsh V C Aug 22 '13 at 13:04
1
You can use use these two:
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Also add AudioToolbox.framework and import it.