Vibrate Phone in UWP

…衆ロ難τιáo~ 提交于 2019-12-07 05:23:37

问题


I'm trying to use the vibration on the device (Windows Phone), however I can't seem to find the appropriate API to achieve this for Windows 10. In Windows 8.x, I can use this, however this is no longer available in Universal Windows Platform.

Can anyone point me in the right direction?


回答1:


As of Jan 2016, you:

Right-click References in your Solution, Add Reference->Extensions->Windows Mobile Extensions for the UWP

Then you can

using Windows.Phone.Devices.Notification;

and actually use it by:

Windows.Phone.Devices.Notification.VibrationDevice v = VibrationDevice.GetDefault(); v.Vibrate(TimeSpan.FromMilliseconds(500));




回答2:


Posted as a comment several minutes ago and now I'm confident this is what you need:

Use the Windows.Phone.Devices.Notification.VibrationDevice class and the Vibrate method it contains.

https://msdn.microsoft.com/en-us/library/windows/apps/windows.phone.devices.notification.vibrationdevice.vibrate




回答3:


check this, might help you. and the link you are using may be using a different api. anotehr thing I found on Microsoft documentation is that you cannot trust it, keep that in mind https://msdn.microsoft.com/en-us/windows.phone.devices.notification.vibrationdevice.vibrate



来源:https://stackoverflow.com/questions/33502601/vibrate-phone-in-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!