简体   繁体   English

如何在Windows Phone 8中播放SMS警报声音

[英]How to play the SMS alert sound in Windows Phone 8

I'd like my app to play an alert sound and vibrate the phone when a certain page is loaded. 我希望我的应用在加载特定页面时播放警报声音并振动手机。 Specifically, I want to play the SMS alert sound effect that the user has picked from the settings. 具体来说,我想播放用户从设置中选择的SMS警报音效。 I already have the vibration done, but I'm not sure how to get the SMS alert sound to play. 我已经做完振动,但是不确定如何播放SMS警报声音。

Does anyone know how I would go about doing this? 有人知道我会怎么做吗?

Unfortunately you don't have access to the phone's alerts and sounds. 不幸的是,您无权访问手机的警报和声音。

One way to do this, is import a media in your project, with it's build action set to content and use the MediaElement class to play a sound, by calling its .Play() method in code-behind. 一种实现方法是,在项目中导入媒体,并将其构建操作设置为内容,并通过在代码后面调用其.Play()方法,使用MediaElement类播放声音。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM