How to run a WP7 silverlight application after some period of time? - windows-phone-7

I have an application in WP7 silverlight that needs to be launched after a specific period of time, something like an alarm.
But I want to launch the application itself not WP7's alarm.
I use:
this.Visibility = Visibility.Collapsed;
for hiding the application, I know it is not the correct way for making it run in the background.
Any hint please? Thanks.

The platform specifically does not support running apps in the way you describe.
If your functionality can't run in a background agent then your only options are to use an alarm or toast message (sent as a push notification) to prompt the user to start the app.
One of the design decisions behind the platform is that the user should always know what is going on on the phone so having apps stop and start by themselves would be contrary to this.

You can run a background agent and display a toast notification to the user , and launch the application when the user clicks on the toast.
You can also push toast messages to the device, and rely on the user clicking the toast .

Related

Windows 8.1 Universal App Multitasking Foreground-Background Cycle

Is there a way to know if the app is sent to background or brought to foreground. I don't mean Suspended and Resuming events.
For example, user leaves the app to check something on Facebook app for a min. And then return to back to my app. So suspention doesn't take effect on this scenario. Then how to know user is back to the app on app.cs level?
As stated in the MSDN documentation:
Your app doesn't receive an activation event when app visibility changes, because the app is still running. Windows simply switches to and from the app as necessary. If your app needs to do something when the user switches away and back, it can handle the visibilitychange event (for HTML) or Window.VisibilityChanged event (for XAML).

Detect Touch Event of Windows Phone on any screen

Since, I am new to Windows Phone technology ,so I want to detect touch event of Windows phone screen that means if I have touched on any screen on Windows Phone not necessary in application only outside of application (like start screen,settings screen) so can I get that touch event or any pixel information regarding that touch.Any help would be greatly appreciated .
Thanks you.
To protect the privacy of the user, there is no way to globally hook all touch events from an application. You can only react to events within your application.
Further, an application cannot access the screen while other applications are active. That would be a significant privacy hole if an application could record the actions of other applications.

about Task Manager on Windows Phone

I'm developing a windows phone app, suppose my app is running, user click start key, my app will bring to background, then next user long press back key, the task manager will be shown. My question is here: How can update the screenshots of my app when it was brought to background? I don't want expose anything of my app outside even in the task manager, could I do it? Thanks.
How can update the screenshots of my app when it was brought to background?
You cannot. And it's not a task manager, but a "fast app switch", allowing the user to easy swap between applications. The screenshot you see, will be the last screen of your application when it was in the foreground.
And your application will not be running in the background.
No - you cannot change the image shown in the app switching UI. This is built in OS functionality.

windows phone app running in the background

Is it possible to create an app the runs in the background? If so is there any samples out there for this?
In Windows Phone OS 7.1 you can actually use Background Agents now to perform tasks in the background.
from MSDN:
Scheduled Tasks and background agents allow an application to execute
code in the background, even when the application is not running in
the foreground. The different types of Scheduled Tasks are designed
for different types of background processing scenarios and therefore
have different behaviors and constraints.
You can use a PeriodicTask or ResourceIntensiveTasks. Read more about it in the MSDN article above.
And here's some sample code for you to integrate background agents into your existing app.
Sample Code: Background Agents in Mango
An application in the foreground can continue to run when the phone screen is locked(not background but...) by setting the PhoneApplicationService.ApplicationIdleDetectionMode property. By setting up your application to run when the phone screen is locked, a user is able to access the application quickly upon unlock. However, when your application runs under a locked screen, it could consume power outside of the user's control. For this reason, your application must minimize power usage when running under a locked screen
At the moment there is no way to create application that runs in background.
True multitasking for 3rd party Windows Phone 7 apps will come as an OS upgrade later this year. However, unless the app has to absolutely run in the background (like Pandora etc.), we as developers share some responsibility in making our apps feel at home with the rest of the OS.
Windows Phone OS offers app developers chances to save state of their applications to give the end users the feeling that it never stopped running; this is essentially the same as in other mobile platforms. As your app is being deactivated/closed, you have the option to "Tombstone" your state so that your users can come back to just where they left with BackStack navigation or future launches. Channel 9 had a nice set of demos & labs around tombstoning, found here.
Hope this helps!

is it possible to make an alarm or countdown timer app?

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.
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

Resources