- Home /
Question by
Meznaric · Jan 21, 2015 at 02:27 PM ·
windows phone 8outputvibration
Vibrate Windows Phone 8.1
Unfortunately HandHenld.Vibrate()
is not implemented for Windows Phone devices. I wonder how can I make device vibrate?
As found on this link the code in xaml for normal WP devices for vibration is:
//Use the namespace
using Windows.Phone.Devices.Notification;
//Somewhere in the code:
VibrationDevice testVibrationDevice = VibrationDevice.GetDefault();
testVibrationDevice.Vibrate(TimeSpan.FromSeconds(3));
I imagined that both of this snippets have to be pasted between this two tags, but namespace is not found. I tried adding reference to a project but can't find any Windows.Phone
reference.
#if UNITY_WP_8_1
//Snipet here
#endif
Comment
Answer by iwunu · May 13, 2016 at 06:04 PM
#if NETFX_CORE
Windows.Phone.Devices.Notification.VibrationDevice testVibrateController =Windows.Phone.Devices.Notification.VibrationDevice.GetDefault();
testVibrateController.Vibrate(TimeSpan.FromMilliseconds(milliseconds));
#endif
@Meznaric: It's OK on winphone 8.1
Your answer
Follow this Question
Related Questions
using multiple monitors / video outputs? 5 Answers
Very low FPS, only build shows problems? 0 Answers
Unity UI: Text Adventure 2 Answers
Make a motor turn in real life. 0 Answers
Elevator vibrating!!! 1 Answer