0

in my application, i need to put a switch for notification settings. I put a sound switch so when a switch is off and I will get a notification, the sound will not come. this is working because when a sound switch is off I am sending JSON without sound. Now I want same functionality for vibration. when vibration switch is on my device should vibrate when I receive a push notification and it should not vibrate when my vibration switch is off.

Govind Rakholiya
  • 427
  • 6
  • 24

1 Answers1

0

First of all import these:

import UIKit
import AudioToolbox

Then write this code in switch action for vibration:

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))            
User511
  • 1,456
  • 10
  • 28