Modifying iPhone Camera/Flashlight? - ios

I was wondering if there's anyway to modify how the iPhone takes pictures. Specifically, if you can turn off the dimmer focus flash that shows up before the full flash, so when you take a picture it's just the full flashlight that comes on immediately. Thanks!

Unfortunately, no, I think not. From the apple developer site:
Flash Modes
There are three flash modes:
AVCaptureFlashModeOff: The flash will never fire.
AVCaptureFlashModeOn: The flash will always fire.
AVCaptureFlashModeAuto: The flash will fire dependent on the ambient
light conditions. You use hasFlash to determine whether a device has a
flash. If that method returns YES, you then use the
isFlashModeSupported: method, passing the desired mode to determine
whether a device supports a given flash mode, then set the mode using
the flashMode property.
And there is no mention of the dimmer flash.
EDIT: Maybe you can. There are lots of iOS apps that do this
2nd Edit: After looking at this, I have concluded that you cannot do so.

Related

How to check whether device set vibration mode or not in iOS programatically?

I am making a VoIP application for iOS. For incoming calls, I have set some custom ringtones. It's working fine, but I want to check whether the device settings are set to Vibration mode or not programmatically.
I have searched on the web regarding this issue, but I've only found answers for silent mode detection. Instead, I want to check whether the device is in vibration mode or not.
When an incoming call comes to my app, I want to use vibration mode if the device settings are set to vibration mode.
Could any one help me?
At first look it seems like none of the Audio Session properties allow you to read the value of this setting. However an alternative, albeit not exactly what you're looking for, is to check if the ringer is set to on-or-off and provide at least a semi-expected vibration experience to your user.
Ronak Chaniyara pointed you to the right answer here, however that is deprecated in iOS 7.0. Instead use AVAudiSession -setCategory to set the proper category of your audio. If you expect your audio to be muted by the silent switch or screen lock use AVAudioSessionCategorySoloAmbient otherwise use AVAudioSessionCategoryPlayback.
More details on AVAudioSession, it's settings and properties can be found here.

Apple Configurator - Single App Mode

I have successfully locked my iPad to use the Single App Mode.
I notice that I can no longer power off the device by holding the power off button - Is this by design? Can this option be overridden?
I fail to understand why Apple would disable the power off button as part of the Single App Mode.
This is by design.
The intent of the single app mode is that you're using it for something like a store display, and you are restricting it to doing only that one function. You wouldn't want hooligans turning off your display, so it doesn't allow you to.
To my knowledge, there is no way to change how this works.

How to know whether my application is visible or not?

I've seen some software which can detect whether or not a form is visible to the user. This might include being minimized, another screen covering it up, monitor turned off, and even when on remote desktop, knows when the remote desktop view is not visible. I'm guessing it has to do with whether or not anything is being drawn in the application. Perhaps video drivers can provide this information?
How can I make my application to detect this? Is there a Windows message I can monitor for this?
For the record, the mentioned software is one which streams multiple surveillance cameras in real-time (RTSP) which uses this ability to the advantage of pausing streaming when the screen isn't visible.
Most of the conditions do not have window messages associated with them, so you have to detect the conditions manually.
Use the TForm.WindowState property, or the Win32 API IsIconic() function, to detect your window's minimized state. You can also catch WM_SYSCOMMAND messages looking for the SC_MINIMIZE, SC_MAXIMIZE, and SC_RESTORE states.
Use the Win32 API EnumWindows() function to loop through all top-level windows, calling GetWindowRect() on each one, to detect if any areas of your window are not covered by other windows. To account for z-ordering, you may have to use GetTopWindow() and GetNextWindow() to iterate the z-order to see which window is on top of the other window.
Use MonitorFromWindow() and GetDevicePowerState() to detect the local monitor's power state. You can also catch WM_SYSCOMMAND messages looking for the SC_MONITORPOWER notification.
Detecting the Remote Desktop state is a bit trickier. You can use ProcessIdToSessionId() and WTSQuerySessionInformation(WTSIsRemoteSession) (Windows 7+) or GetSystemMetrics(SM_REMOTESESSION) to determine if your app is running inside of a Remote Desktop session, but I don't think you can detect whether the remote display is on/off (although WTSQuerySessionInformation() can query the remote display's resolution and color depth, and even if the session is locked/unlocked).
I'm guessing it has to do with whether or not anything is being drawn in the application.
For partially obscured windows, Canvas.ClipRect (which is equal to the rcPaint member of PAINTSTRUCT or the result gotten from GetUpdateRect) will be the portion of the device context that has to be redrawn. GetUpdateRect can be called outside a WM_PAINT handler, Canvas.ClipRect only within.
But if you could of would solely rely on paint messages being sent, I am not sure. I think Remy's suggestions are more robust. Or a combination of all.

How to turn off blackberry device

Is it possible to turn off Blackberry Device programmatically ?
Perhaps you could use requestPowerOff() method in the Device class.
As far as I know there is no "clear" solution for that. Take a look on this thread: http://supportforums.blackberry.com/t5/Java-Development/Turn-on-off-Bluetooth-programmatically/td-p/489615
But you can use key injection to turn device off. It works quickly enough, so from the user perspective that device is just switched off.

What is the name of the method for screenshot on iOS

I was wondering if there was a specific method called when we press the 2 buttons of the iPhone (using Home-Button & Power on/off) to take a screenshot. If yes, I would known his name to use her in programming.
There used to be a UIGetScreenImage() function that you could use to capture the screen. Apple no longer allows use of that function in App Store apps, so you have a few other options. CALayer has a -renderInContext: method—Google it—that you can use to copy a view’s contents to a graphics context; this does not, however, work for OpenGL content, video, or live imagery from a device’s camera. I’m not sure about solutions for the first two, but for the latter—getting images from the camera—you’ll need to use the AVFoundation framework.
It is a system level service for which the app never receives any notification or method call.
I believe that would be a native method, not accessible from the IPhone SDK. In what context are you going to be using this? You might be looking for this - Take screenshot from code

Resources