User Notification: Custom Vibration pattern

Viewed 3532

Is it possible to create custom vibration pattern for the user notification alert? example, we can choose to have different audio for the user notification. Is it possible to have custom vibration pattern as well?

I mean do this programmatically on iOS using swift.

2 Answers

You can try this. In the below code you can get different types of vibrations with audio and without audio. make sure that you have imported these (import AudioToolbox, import AVFoundation)

if(selectedRow == 0){
          AudioServicesPlaySystemSound(SystemSoundID(1304))
        }else if(selectedRow == 1){
             AudioServicesPlaySystemSound(SystemSoundID(1329))
        }else if(selectedRow == 2){
            AudioServicesPlaySystemSound(SystemSoundID(1301))
        }else if(selectedRow == 3){
           AudioServicesPlaySystemSound(SystemSoundID(1027))
        }else if(selectedRow == 4){
           AudioServicesPlaySystemSound(SystemSoundID(1028))
        }else if(selectedRow == 5){
            let alert = SystemSoundID(1011)
            AudioServicesPlaySystemSoundWithCompletion(alert, nil)
        }else if(selectedRow == 6){
           AudioServicesPlaySystemSound(SystemSoundID(1333))
        }else if(selectedRow == 7){
           AudioServicesPlaySystemSound(SystemSoundID(4095))
        }
Related