I am currently developing an App with VoIP functionality. When a new call comes in I am sending out a notification with a custom sound.
If the phone is on vibrate, it vibrates once by default. However I would like to make the phone vibrate during the entire, custom sound (30seconds).
Is there any "build-in" way? Or would I have to actively trigger vibration from my AppDelegate when I receive my VoIP Push? Can I face any AppStore certification problems if I do it from there? (Facebook Messenger and WeChat provide this behaviour for example, so there has to be a way :) )
Both of the functions vibrate the iPhone. But, when you use the first function on devices that don’t support vibration, it plays a beep sound. The second function, on the other hand, does nothing on unsupported devices. So if you are going to vibrate the device continuously, as an alert, common sense says, use function 2.
First, add the AudioToolbox framework AudioToolbox.framework to your target in Build Phases.
Then, import this header file:
Also, if you want to vibrate once every 5 second (or whatever), you can do this.
NSTimer *timer //declare this globally (in header file)