I need to vibrate iOS device, devices that don’t support vibration, Will plays a beep sound.
For this I am using
Import AudioToolbox.framework
#import <AudioToolbox/AudioToolbox.h>
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
It vibrate on iPhone device, but No sound on iPad and iPod. While refrences say that it will play sound. What I am doing wrong ?
http://blog.mugunthkumar.com/coding/iphone-tutorial-better-way-to-check-capabilities-of-ios-devices/
Try setting the AudioSession:
#import <AudioToolbox/AudioToolbox.h>
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = nil;
[audioSession setCategory: AVAudioSessionCategoryPlayback error:&err];
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
//or: AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);