Is it possible to know when application starts in windows phone 7? - c#

I want to know is there any mechanism by which my C# code knows that application starts. For example when camera or music player starts then my app know each time that camera or other app has started.

No, you cannot listen for when other applications start. You can use Launchers and Choosers to start the Camera from inside your own application, but you cannot listen on other applications.
Anyway, such a application would also be considered spyware.

Related

Global HotKey in Universal Windows App

So I created an UWP App that can record several Audio Lines and save the recordings to MP3 files for in-game multi-line recording that I can later edit separately (game audio, microphone, game comms, voice comms) as NVidia ShadowPlay/Share does not support this yet. I achieve this multi-line setup with VAC.
I have a version of this tool written in regular Windows WPF C# and I have a system-wide HotKey Ctrl+Alt+R that starts/stops recording so when I'm in a full screen game, I can start/stop recording without exiting full screen mode (switching window focus).
Can a global (system wide, app window not in focus) HotKey that triggers some in-App event be achieved in a UWP App? I know the functionality is not supported for other platforms. But I only need it to run on Windows 10 Desktop and the HotKey support is mandatory. Or can I achieve my goal in any other way for UWP Apps?
GOAL: System wide key combination to trigger in UWP app event without switching Window focus and messing with full-screen games.
at the moment it is not possible to solve this task thoroughly.
You are facing two limitations of UWP and can be only partially solved:
Lifecycle: UWP apps go in suspended state when they are not focused. They just "block" to consume less resources (and battery). This is a great feature for mobile devices, but is bad news for you project. You can solve this by requesting "ExtendedExecutionSession" which will guarantee that your app never falls asleep when out of focus if "attached to wallpower".
Detect input without focus. It's clearly stated on MSDN that UWP doesn't support keyboard HOOKS (this refers to SetWindowsHookEx). They reinvented "GetAsyncKeyState", now it works only when the Windows is focused. Indeed you can find that under CoreWindow.GetAsyncKeyState().
If you only need to use F Keys as hotkeys you can still do something, like "press F2 when the app is minimzed to activate a function".
Use Stefan Wick example. He solved part of the problem.
Instead if you need to listen to lots of keys (or mouse events) there isn't a way. You can't right now.
Curiosity
UWP has restricted capabilities, one of which called "InputObservation".
At the moment it is not documented and impossible to implement (unless you are a select Microsoft Partner), but it should allow apps to access system input (keyboard/mouse..) without any limitation and regardless its final destination.
I think this feature is the key for system-wide inputs detection.
I am not able to find a way to implement it.
Kind Regards

Minimize Windows 8 Store App while tracking location with GPS

I'm working on a metro app and am having trouble finding how not to show the application.
We recently deployed tablets to our field reps, and need to add gps tracking. GPS is much easier to deal with in the metro libs (it's like 4 lines of code vs. unmanaged) so we're hoping to be able to push a metro app instead of spending time coding a winforms/wpf desktop app (the tablets are full version windows, so it's an option if we can't hide a metro app. I feel like it should be possible though as the start screen tiles update automatically without opening the main program).
In WPF, it's fairly simple to make a window invisible. I'm creating the metro app in wpf, but it uses different libs than desktop and I may just not know how to do it.
In desktop programs, it's fairly simple. You do something along the lines of:
<Page
x:Class = xxxxxxxx
..
Visibility="Hidden">
Unfortunately, with metro, the only options I have are collapsed and visible. Collapsed doesn't seem to have any effect, unless it's just because it's not deployed and visual studio shows it anyway...
So basically I'm trying to figure out if there's a way to start the program minimized or hidden so that it doesn't interrupt the field reps every time it takes their location.
If you really want to make a metro app and want it to run "minimised" you will need to look at background task. To start the background task the user would still need to start the app at least once, futhermore background task have limitation how how often and how long they can run. Also there is a lot of constraint on deploying a windows store app if you cannot publish it in the store.
If your goal is to just have access to GPS through C# apis, the GPS is actually one of the winRT api you can use from the desktop, you can find a tutorial on how to access winRT api from the desktop here
Here is the complete list of winRT api accessible from the desktop (You can find Geoposition class among them).
Have you looked into creating a background task that transmits GPS? The background task can run without the app running.
I am not entirely certain you can voluntarily minimize a Windows Store App on a user's behalf. I see nothing in IntelliSense about it, nor have I found anything online or see any app do it.
However, be aware that deploying the app without using the Windows Store -- sideloading -- requires Windows 8 Enterprise edition computers joined to the domain OR Windows 8 Pro with a sideloading key ($30 per key, purchased in packs of at least 100.) Perhaps a WPF app with unmanaged code is worth the money and effort.

MediaPlayer vs BackgroundAudioPlayer

I'm developing an Windows Phone application, that plays/streams music in background.
To accomplish that, I tried to use both Microsoft.Phone.BackgroundAudio.BackgroundAudioPlayer and Microsoft.Xna.Framework.Media.MediaPlayer classes.
In both cases everything worked just fine, so I was wondering, what are advantages/disadvantages of these methods, because now I can't decide which one is better.
The only thing that I don't like in BackgroundAudioPlayer, is that I need to create separate project for audio agent, and worry about transferring track info via IsolatedStorage. But since I've done that already. It's not a problem.
So are there any other differences between those two classes?
It depends on your program. If you want to play your background music only while using your program, you should use MediaPlayer. Otherwise you have to take care of the BackgroundAudioPlayer in any situation. Also this will annoy users, who also want to listen to their own music while using your application.
Otherwise, if your background music is the main purpose of the program, the user would like to start your music and switch to other programs. Then it keeps playing and you can control the music in the volume bar. That's why you have to create a background task for BackgroundAudioPlayer. The main application will stop in both ways when switching to other programs.
In short: game background music should never play after leaving the game (use MediaPlayer) - but I never want to watch my music player counting the time, while listening to my music library (use BackgroundAudioPlayer).
I believe MediaPlayer requires the application to be in the foreground. BackgroundAudioPlayer will let the user start a track, exit your application, and the music will continue to play and the agent can respond to the UVC.
Make sure you use a Mutex when you communicate between the foreground app and the background audio agent.

Windows Phone turn flash on in background

I am working on a tools app and I need a way to turn on the camera flash when I click a tile, then keep it on in the background and turn it off once I click the tile again.
I don't need any help with the tile yet all I want to know is what I can do to turn on the flash and then keep it on. All the examples I have seen thus far simply pretend to be a camera and then turn the flash on.
Do you know of anything?
PS. I am planning on making this for WP 7 and 8 but if you know of a way that will on work on WP 8 that will also help me a lot.
The simple answer is no.
While the app is running, you can control the camera and turn on the flash. But as soon as you exit the app (Back button) or the app is suspended (due to a phone call or by pressing the Start button), the use of the camera is suspended.
Windows Phone does have Background Agents but these are very limited and do not allow access to the camera API at all (and many other APIs).

windows system tray application like the volume application

I would like to create a application very similar to the windows 7 volume bar which is located in the system tray. I'm new to windows development and would like a point in the right direction.
Should i just make a normal application and just put in the system tray?
I don't need a main window for the application, it has to accessible only via system-tray (i need only the volume bar, nothing else)... how can i do this?
Would it be better to write it in C++ instead of C#?
How can i detect the "volume" of the sound that is outputted by windows (even if the system sound is muted)?
Thanks for your reply's.
You can by using the class NotifyIcon. Just google for it to find samples. Here is one.

Categories

Resources