How to keep flashlight light on windows phone 8? - windows-phone-8

I created an app, it makes camera flashlight light on to simulate real Torch. But once the Lock screen is on, the flashlight can't stay too long, a few seconds later, the light will off. Is there have any way to keep flashlight light on always?
P.S I found some app on Microsoft App Marketplace, they did this.

The following code will allow your app to continue to run when the lock screen is activated:
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
MSDN link
Example

Related

How to show a floating message in windows phone (Android Toasts)

How can I implement the behaviour of an Android Toast, that is, a floating message that is auto dismissed after some seconds without requiring a user interaction?
Thanks
In Windows Phone there are toasts available. They can be showed on demand or be scheduled. They are shown at the top of the screen and dissapear after a while. A sample toast showed on demand can look like this:
ToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
XmlNodeList textElements = toastXml.GetElementsByTagName("text");
textElements[0].AppendChild(toastXml.CreateTextNode("MyApp"));
textElements[1].AppendChild(toastXml.CreateTextNode("Message"));
ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(toastXml));
You will find more information at MSDN.
NOTE that the code above is for WP8.1 RunTime and Universal apps. If you are looking for Silverlight example, take a look st ShellToast and tutorial at MSDN.

KEEP_AWAKE, but turn off screen to save battery?

I have built a fun little MP3 player using FlashDevelop and Flash CS5.5 IDE (no Flex).
The app 'emulates' old school style radio by fading tracks from any chosen m3u playlist while interspersing random radio stabs, silly fake ads and dj chatter (much like Flash FM from GTA Vice City).
The app itself works very well, however, if I set SystemIdleMode.NORMAL the app stops when the screen saver kicks in, and when I set to SystemIdleMode.KEEP_AWAKE, the screen never kicks in and the app runs until the battery dies ... which unfortunately doesn't take too long ;)
Is it possible to 'disable' the screen while leaving the app running to help save battery?
If no, can I at least control brightness, and perhaps display a black overlay? Would this have much effect on battery life?
Any suggestions would be hugely appreciated.
Cheers.

Soft vibration, in an app

Okay I'm developing a win phone app, and I have buttons here and there and I want the phone to vibrate when someone hits a button.
I managed to do that with
using Windows.Phone.devices.Notification;
VibrationDevice v = VibrationDevice.GetDefault();
v.Vibrate(TimeSpan.FromSeconds(0.1);
However that vibration is rather strong and annoying to get everytime someone hits a button, I'm wondering, do we get access to the soft vibration? Like when someone hits the windows button / back key / search glass - those three buttons have a more soft vibration
For WP7.1 you could use XNA:
Microsoft.Xna.Framework.WindowsPhone.Input.GamePad.SetVibration(player, leftMotorStrength, rightMotorStrength)
However, for Windows Phone 8 this is not possible.
Please refer to MSDN for more details.
You can use a shorter timespan. Do some experiments on different devices. You might need to use different values for different devices.
I got a really nice soft vibration from Samsung ATIV Odyssey with TimeSpan.FromSeconds(0.01). However, HTC 8X seems to ignore a timespan this short - the results with 0.02 was somewhat inconsistent; 0.03 was a good one.

Why my apps have black screen in Fast App Switcher?

Any ideas why my app would draw a black screen when it's dormant/suspended (user presses window-key, and then long-presses back-key to view all dormant apps)?
It's Directx113D app, and should be very close to the implementations of Marble Maze and Direct3D samples. They show up just fine.
I've done my best to break these two samples in a similar fashion but no luck. Any ideas?
Okay, I've got this one solved.
The problem was with alpha. I don't know why, but when the app has the focus, it draws alpha just fine. However, when send to background alpha blending somehow is turned of and alpha for each pixel remains 0. For my blendstate I changed:
SrcBlendAlpha = D3D11_BLEND_ZERO
DestBlendAlpha = D3D11_BLEND_ZERO
to
SrcBlendAlpha = D3D11_BLEND_ZERO
DestBlendAlpha = D3D11_BLEND_ONE

AIR app inactive = lower framerate?

I'm working in a quite uncomfortable setup and I'm trying to figure out how I can fix it.
I'm developing an AIR app that is receiving TUIO events from a Framework for a fiducial marker based multitouch table. Until yesterday I was faking the events by mouse to work faster, but then I connected everything to a TUIO simulator and the problems appeared.
The TUIO Simulator is a java app. By dragging markers on the simulator you can send OSC messages that I'm forwarding to my AIR app. The problem is that I'm noticing that when I drag something on the simulator, my AIR app lose the focus, and the AIR framerate suddendly drops. If I drag something on my simulator and I switch super fast to the AIR window, everything goes smooth, so it seems the problem is that if my AIR app is not the active app it's redrawn at a lower framerate (I remember reading something about this, not sure).
So my questions are: am I right about the fact that inactive windows in AIR are redrawn at lower framerate? do you have any suggestion/workaround to fix it and to allow me to interactive with the java app without my AIR framerate drops?
Sorry guys, I figured out the solution by writing the question :)
I just added:
this.stage.addEventListener ( Event.DEACTIVATE, onDeactivate );
private function onDeactivate (evt:Event):void {
stage.frameRate = 60;
}
In my main class, and everything is fixed.
I post the answer for people that could have the same problem in the future