Get an iPhone for Vibration

I am trying to make iPhone vibrate with this code:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

But it doesn’t work, maybe because I play the sound at the same time as the call?

+3
source share
4 answers

This should work fine. Is vibration on the device turned off?

+6
source

If this helps someone, I found that the vibrate command would not work while AVAudioRecorderit was recording. Getting around this is very simple. You just need to first stop your recorder and resume it:

[recorder stop];
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
[recorder record];

It even works if you want to record sound and vibrate in the background with UIBackgroundModes.

+15
source

iPhone 4. System Sound, , .

, , : . Ring/Silent Silent .

, , .

+3

On all the iPhones I tested (original, 3GS and 4), it should vibrate. On iPod touch 1st generation, it will play a sound through the built-in speaker. On iPod touch second generation, he will not do anything. He will not do anything on the iPad either. These are all the devices on which I tested.

0
source

Source: https://habr.com/ru/post/1757393/


All Articles