Windows Phone - know when the screen is on - windows-phone

I'm working on an app that changes the lock screen background, and I would like to know when the user turns on his phone and looks at the lock screen.
The reason for my question is that if I know that the background has been watched, I will be able to replace the background.

There is no way to do what you're describing. When your application isn't running, you have no information whichever about user's activity.

You cannot do that. If your lockscreen is activated you cannot Access to App data, for security reason.
So, as KooKiz said there is no way to do that.

Related

Detect screen shutdown in vb.net

I'm building an application using vb.net that should record some specific user actions, one of these actions is the screen shutdown, is there a way to do that? Maybe a system event or something that i can check periodically to know if the screen is active or not.
I've already found some code to check if the screensaver is running but i want to know if there's a way to detect if the screen is phisically turned off.

How do I programmatically navigate to the start screen from within a Windows 8 javascript app?

I am developing an app that allows the user to make certain changes to tiles on the Windows 8 start screen. When a change has been made within the app, the user will be shown a "View my changes" button. Clicking the button should bring the user back to the start screen.
I have looked into different ways of closing/suspending the app programmatically (and thus taking the user to the start screen), but I have not found a way to achieve this using WinJS. Throwing an exception closes the app, but this seems like a very dirty workaround. Any suggestions?
I'm assuming you are creating secondary tiles and want to show the users what they look like? #mydogisbox is right in that this kind of functionality has probably been deliberatly excluded.
I'd recommend to just do an in-app 'view changes' of whatever changes to secondary tiles the user might have made. In general, I'd argue that this would be a better user experience because you will keep the user engaged within your application and not be essentially kicking them out of the experience.

Keyboard event from anywhere

I want to build an app that does something when the user pushes a (keyboard) button, no matter what app is currently running in the front. (Like "CheatSheet")
How can I do this?
Do you mean keylogging input from other apps? If so, this is not possible due to obvious security concerns.

Can a WinRT app continue to run while Screen Off?

Can a WinRT app continue to run while Screen Off?
I know that a WinRT application can create a Background Task that periodically executes even when the application is not running. Handy, but not what I am asking. What I am asking is, when the user clicks the power button and invokes Connected Standby, is there anything an app can do to remain active. Can it ask for some special capability?
Example - in Windows Phone there is a handy Running and Walking app that keeps track of "where you are" while it is running - then tallies your distances, etc. Even when the screen is off! Turn the screen on and the "where was I" map is up-to-date. Is this type of application possible in WinRT?
I've been looking into the same thing recently, and unfortunately it seems that what you want to do isn't possible with WinRT.
Why don't you use Background task to simulate what you are trying to achieve. When the user starts the app again, you could have the info populated to the latest data by looking at the store where the background process updated. Just a thought.

Windows Phone 7 Notifications/Pop/Toasts

If there a way to display a normal Notification/Toast/Popup in Windows Phone 7, which is not a Push Notification?
All I want to do is to be able to give the user a message when something occurs...
I assume you wish to display something while your application is not running in the foregorund. Because, when your application runs in the foreground, you can do whatever you want.
Your application can't run in the background, therefore you don't really have any means of invoking anything. This means you can't really display a message when somethien occurs.
What exectly occurs on the phone that you need to notify the user? Is that really not back-end related?
There are two great sample chapters on Windows Phone and Silverlight for Windows Phone on the LearningWindosPhone.com site. There is great Windows Phone Trainng material , and dont forget the Windows Phone Develoeprs Blog
You can use MessageBox.Show(), though this creates a modal dialog box.
If you want to display the notification while your app is not running (but when you're doing some background work) then I believe this is what you want:
ShellToast toast = new ShellToast();
toast.Title = "My app";
toast.Content = "Hello from my app's background task!";
toast.Show();
For some reason, this doesn't display anything if your app is already running. If you want to display a message then, you can use MessageBox.Show() (if you're OK forcing the user to click OK), or you can use the Coding4Fun Tools that Haider links to.
It would be fairly straight forward to reproduce the visual effect of a toast from within your app. You could use a fixed height, full width canvas with a TextBlock control and animate it's appearance using a storyboard.
How to bind toast notification with schedule in windows phone