views:

48

answers:

1

I'm a complete noob when it comes to WP7. From what I know of it, in WP7 you wouldn't be able to make an alarm clock app. As in, start app, set alarm for an hour from now, close app, app launches and rings alarm after an hour is up.

Is this not possible in WP7? Or is there some way of doing it that I'm not aware of? I have seen a workaround for a stopwatch using tombstoning, but that doesn't seem like it would work here.

+3  A: 

With Windows Phone 7 [for 3rd party developers] it's not possible to write an application that runs in the background on the phone. (This was a deliberate decision with regards to maintaining performance and battery life - not a limitation of the OS which is fully multi-tasking.)

If you really want the user to be notified of something at a specific time, regardless of whether your application is running you'll need to have this monitored from a process on an external server and then send a [toast] notification to the user at the appropriate time.

Learn more about push notifications at http://msdn.microsoft.com/en-us/library/ff402537(VS.92).aspx

Matt Lacey
I'm surprised that the answer to this is that complex. If I'm having signal trouble my alarm clock won't go off? o_o
jcollum
@jcollum yup, without connectivity, you won't be able to receive toast notifications. Microsoft might add multitasking support for third party apps in the future to enable the sort of scenario you're after, but for now, applications can't automatically launch themselves or hide in the background.Would be interested in more detail in the sort of scenario you're trying to do with your app though? WP7 comes with a perfectly serviceable alarm application so you'd be hard press to sell an alarm app :P
Blakomen
Also - a toast notification can't launch an app; the user has to tap on it to launch your app, so if the notification is ignored/dismiss, your "alarm wont go off".
Blakomen
@jcollum If it's really that important to get the attention of the person who's phone it is, consider sending a text message or making a[n automated] phone call to them instead.
Matt Lacey
@all: I'm doing this as more of a thought experiment: let's take a simple app and see how much work it would be on ios, android and wp7. On wp7 it's far more work. Also, I wonder if the onboard Alarm app has some sort of special 'allow multitasking' switch.
jcollum
@jcollum Applications made by Microsoft, operators and selected partners have the ability to create applications which run in the background (and other privileges and API access also). A deliberate decision was made to not allow background processing of 3rd party apps as a way of trying to, amongst other things, preserve battery. Yes, this means that your scenario becomes more complicated to implement but that is the trade off in platform design which has been made.
Matt Lacey