I have been asked to make a morse code app using Windows Phone 7.
I need to be able to press the lock button multiple times to trigger my app to detect what sequence and timings have been pressed.
For example if I press the lock button on my phone (HTC Radar) five times I want my app (which would be running in the background) to detect that it has been pressed five times and at what timings so that I could figure out .- or "short / long" patterns then open itself up.
How would I go about this?
I have used XNA and C# for XBOX but not for mobile devices.
Thank you.
There is no API to solve your problem.
Your application can subscribe to the Obscured event. But this event does not mean that exactly lock button was pressed. It could be the SMS or phone call.
You can't do the background application wich will run all the time, and handle lockscreen button.
Related
I'm trying to implement unity ads for the first time in an android game. Everything seems to be working properly except for one thing. When the ShowAd method is called
it takes 2 seconds for the advertisement to be actually displayed, during which time if you turn off and open the phone screen, the game stops, superimposing a black screen on the screen. I think what really happens is that the ad starts in the background until the application loses its focus, and when I reopen the phone the ad closes automatically leaving only the black screen. I thought that to avoid this, I should reload the application based on a check in onapplicationfocus function, such as: if the user pressed the lock button on the phone, if the screen is closed, or simply a check if the application is lost focus due to the ad or another event. Another solution would be to configure the application to run in the background somehow, but I did not manage to apply any of the above. Does anyone know how to apply one of the above? Thanks in advance!
I try to make a NumPad similar to the one in the standard Win10 Calculator App.
I implemented a function where the user can press a number on the hardware Keyboard and it will press a button programmatically. To get the number is no problem but I also want to start an animation on the software NumPad like the one in the Win10 calculator.
How can I start that animation by code?
NumPadAnimation
How can I start that animation by code?
You could start the storyboard(the animation) by calling the the Begin method of the Storyboard.
Please read Storyboarded animations for more information.
By the way, the MS calculator is now open source. You could check its source code to learn what you want.
I am trying to make a torch application in windows tablet. The ultimate aim is that "User should have immediate access to the torch". I managed to put the application in the settings tab of charms bar. But it requires 2 clicks, first on the setings bar then torch application.
Is it possible to put the application in the charms bar itself?, so the user can launch the application with a single click.
Or is there any way to get a trigger from external keys?. Something
like, "long press on the volume key will launch the application", or "long press on camera button etc..".
Any Help will be highly appreciated :).
First, no way to launch the app in the Charms bar.
You can register a event handler to HardwareButtons.CameraPressed
HardwareButtons.CameraPressed += HardwareButtons_CameraPressed;.
NOTE
By using HardwareButtons you shold first add reference of Mobile Extensions if you are developing UWP apps.
Current scenario stands like this:
User opens my app
Background audio agent starts playing
User goes back to start screen
Audio keeps playing from the background audio agent
User kills the application from the "task bar" (the closing button in upper right corner)
Background audio agent keeps playing.
I need to achieve following:
Close the audio background agent when the user kills the application (I know that I can use the close method on the backgroundaudioplayer but I need to call this when the application is killed/exited).
Questions:
Is there any event besides: Application_Deactivated / Application_Closing when the user truly exits/kills the application?
If there is no event like mentioned above - can I tell from Application_Deactivated / Application_Closing when the user really exits/kills the application?
Thank you
there is no way to detect when an app got closed by the task switcher or system. Usually apps keep tombstoned until they get either reactivated or killed. You have to do all the clean-up work in the Application_Closing and Application_Deactivated events.
This has one simple reason: When an application lies in the background it is freezed and cannot execute code. Whenever the user or the system kills it (to get more memory for example) the app and all its data get completely wiped out of the memory. Without notifying your app and without giving it the chance to gain performance (which would be counterproductive).
So you just have the chance to use the Application_Deactivated event when the user tap the start button or another app is launched or the Application_Closing event when the user closes the app via back button.
Read this if you need additional information about the Windows Phone 8 Application lifecycle.
Beside this a user would expect that the background audio is still running after he closes the application. A podcast for example should also play when I closed the podcast app. What kind of audio are you talking about? Maybe we can find a smart solution...
The only events you can react to are Closing and Deactivated.
So here,you can call BackgroundAudioPlayer.Instance.Close() in "Application_Closing" event only.
I have an game application I have written for Windows Mobile and I want to have a timer associated with the puzzle. If the program loses focus for any reason (call comes in, user switches programs, user hits the Windows button) then I want a pop up dialog box to cover the puzzle and the timer to stop. When the user closes the pop up dialog the timer can start up again.
Does anyone know how to do this?
Thanks
Take a look at the article over at OpenNETCF's Community site on determining when a Form or Process changes.
A quick way would be to use PInvoke to call GetForegroundWindow() and GetWindowText() whenever your timer ticks (once a second?).
GetForegroundWindow() returns a windows handle which you can use to call GetWindowText(). If the text of the foreground window matches your form's Text property (its caption), you know your app has the focus. You can then show or hide your puzzle in each timer tick.