开发者

How to play sounds periodically?

开发者 https://www.devze.com 2023-03-10 02:55 出处:网络
With the new WP 7.1 they added Background Agent to play sound files from within your application, and TaskScheduler Agent to run tasks periodically.

With the new WP 7.1 they added Background Agent to play sound files from within your application, and TaskScheduler Agent to run tasks periodically.

However:

  1. I wan开发者_C百科t to play sounds periodically even if my application is closed.
  2. TaskScheduler does not allow to play audio via XNA sound effects, BackgroundAudioPlayer or MediaElement (http://msdn.microsoft.com/en-us/library/hh202962%28v=vs.92%29.aspx)
  3. TaskScheduler runs for a specific time with a FIXED interval of 30 seconds. I need to play a sound every hour on the hour.
  4. Alarms can have a sound set to them, but there is no way to customize that dialog to not show and not need snooze or dismiss functionality.


There's no way to play sounds from a Background/Live Agent as there is no way to implement the required UI prompts that would be needed to satisfy the marketplace certification requirements around other music which may be playing on the device at the time.

In theory you could create the functionality you are after with an hour long track that is mostly silent which you play via a background audio player. In reality though this would likely be a big drain on the battery and would prevent the user playing other music.

If you can explain why you want to do this we may be able to make alternative suggestions.

Also note that the length of time a scheduled agent can run for is a MAXIMUM of 15 seconds every 30 minutes (plus or minus 10 minutes).


Is there now a possibility to play the sound on the setting timer even if we close the application ?

0

精彩评论

暂无评论...
验证码 换一张
取 消