简体   繁体   中英

WP8 timer app under lock screen

I have app with dispatcher timer. User set some interval(for example 30 sec) and press button start. App Each 30 sec play sound. All work ok. But when User lock phone timer stopped and nothing played. Can I play sound each 30 sec when phone is locked?

It is possible to keep the app running under lock screen.

Using Idle Detection , you can keep the app on, although screen is locked. Actually, it is not running in background, but in the foreground. Just the screen is locked. So, be careful not to drain user's battery.

You have to set the PhoneApplicationService.ApplicationIdleDetectionMode property to Disabled , for example in InitializePhoneApplication() method in App.xaml.cs :

PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;

Note that there are special certification requirements for this type of apps. Refer to section 6.3 (Apps running under a locked screen) of the following page:

Additional requirements for specific app types for Windows Phone

yes. sure.. You can use the Scheduled Task Agent in windows phone.

using the Scheduled Task Agent, when you app is not running or stopped (not in background). you can fire your Events.

For that you have to add the scheduled task agent into your project. And in the ScheduledAgent.cs file find the OnInvoke method and put your code here. this method performs the task in Background. (Means the code is executed when your phone is locked).

for more Reference click here Implement background agents for Windows Phone

I hope you get the destination. Now, just put that code into your application and its working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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