0

I know that we can able to perform vibration from iOS mobile app.
But I need to know whether we can perform vibration from Today extension / Widget on some action like a button action?

Bharath
  • 2,064
  • 1
  • 14
  • 39
  • Possible duplicate of [How to make iPhone vibrate using Swift?](https://stackoverflow.com/questions/26455880/how-to-make-iphone-vibrate-using-swift) – MQLN Nov 16 '17 at 02:36
  • @MQLN my question is not general, please read it again, I'm specifically asking for widget not within the app. – Bharath Nov 16 '17 at 03:39
  • Vibration and haptic feedback are different things. Which one are you asking about? – matt Nov 16 '17 at 04:08
  • @matt Thanks for mentioning it, I'm asking about vibration – Bharath Nov 16 '17 at 04:17
  • @all: Guys I got the answer and I have added it to the answers list for reference. If in case you wonder whether vibration is possible in "Widget", Yes it is. I have tested it. – Bharath Nov 24 '17 at 18:26

1 Answers1

-2

This has already been answered here.

import AudioToolbox
//Swift: 
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
//Obj-c: 
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
MQLN
  • 2,292
  • 2
  • 18
  • 33
  • 1
    Thanks for interest, but my question is wether this could be done from the widget. Please let me know if you know wether its possible. – Bharath Nov 16 '17 at 04:55