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 ?
Making the iPhone vibrate
http://blog.mugunthkumar.com/coding/iphone-tutorial-better-way-to-check-capabilities-of-ios-devices/
Go to Settings > Sounds & Haptics or Settings > Sounds. Select an option (like Ringtone or New Mail) under Sounds and Haptic Patterns or Sounds and Vibration Patterns. Tap Vibration, then tap Create New Vibration.
Turn iPhone keyboard vibration on or off Open the Settings app. Go to Sounds & Haptics > Keyboard Feedback. Turn Haptic on or off.
If you have a sensitivity or intolerance to vibrations, you can customize iPhone to suit your needs. Set vibration options for specific alerts: Go to Settings > Sounds & Haptics. See Change iPhone sounds and vibrations. Turn off all vibrations: Go to Settings > Accessibility > Touch, then turn off Vibration.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With