在 UWP 中振动手机 [英] Vibrate Phone in UWP

查看:23
本文介绍了在 UWP 中振动手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在设备 (Windows Phone) 上使用振动,但是我似乎找不到合适的 API 来为 Windows 10 实现此目的.在 Windows 8.x 中,我可以使用 这个,但是这不再可用在通用 Windows 平台中.

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?

推荐答案

截至 2016 年 1 月,您:

As of Jan 2016, you:

右键单击解决方案中的引用,添加引用->扩展->适用于 UWP 的 Windows Mobile 扩展

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

然后你可以

使用 Windows.Phone.Devices.Notification;

并实际使用它:

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

这篇关于在 UWP 中振动手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆