In Android, how to "DISABLE" bluetooth automatically when the battery level reaches a specific percentage? - batterylevel

Showing "unfortunately stopped" when running my application. I've got battery level percentage but turning off bluetooth is not working. Please help me out
NB: Its not a problem of permissions
if (bluetooth.isEnabled() && level<90)
bluetooth.disable();

Related

Take pictures using camera shutter when receiving live view data

I am developing using EDSDK.
However, if I press the shutter of the camera (physical button) while receiving live view data(EVF Mode), the picture won't be taken. Is this normal?
My camera model is 200D II.
What I'm trying to do is as follows, and it's very simple.
My software activates the camera through EDSDK and receives live view data.
The person behind the camera takes a picture by pressing the camera shutter, and my software shows the picture on the screen.
The questions are as follows.
How to take pictures using physical camera shutter buttons when receiving live view data(EVF).
HDMI connections are not considered because there are features that need to be controlled directly through EDSDK.
Thank you.
Below is what I added after Johannes Bildstein's answer.
As Johannes Bildstein answered, the following code was inserted to unlock the UI.
But it still hasn't been solved.
if (!MainCamera.IsLiveViewOn) {
MainCamera.StartLiveView();
MainCamera.UILock(false);
}
Error message occurs when I try to unlock UI and get EVF data. (Shutter still doesn't work)
If I unlock UI after receiving EVF data,
When dial is in photo mode: EVF data is coming in, but the shutter still does not work.
When dial is in video mode: EVF data does not come in due to BUSY error. Is it a conflict due to UI unlocking? We check your answers and SDK documents and try in many ways, but they are still unresolved. We are currently testing the more recent model, 200D II.
"| EvfOutputDevice.Camera " should be added like below!
public void StartLiveView()
{
CheckState();
if (!IsLiveViewOn) SetSetting(PropertyID.Evf_OutputDevice, (int)(EvfOutputDevice.PC | EvfOutputDevice.Camera ));
}
The camera "UI" is probably locked. The EDSDK does that automatically when connecting and before doing certain commands. You can unlock it with EdsSendStatusCommand using kEdsCameraStatusCommand_UIUnLock.

How to simulate the status bar in Codename one?

I am currently trying to get a local notification to work on an example app. I was following the simple guide here and just copied its code to see it working:
https://github.com/codenameone/codenameone-demos/blob/master/LocalNotificationTest/src/com/codename1/tests/localnotifications/LocalNotificationTest.java
However, in the simulation, I cannot see any changes in the status bar. Is the status bar even simulated or just a static image? Do I have to build the app and send it to an actual device every time I want to test it? That would not only be tedious but also crunch on the available monthly builds.
Is there a setting in the simulator to activate this that I missed?
Thanks and best regards
Local notifications happen in the background which isn't supported by the simulator so this is something you will only see on the device. You can simulate the minimizing of the app (pause/resume) but the Codename One simulator is not a full mobile OS simulator.

How to add progress-indicator in status bar

I have developed an application for OS X. I am now building a status bar application. This application is related to wireless communication, hence I have to connect to a particular device. It is like the wifi status bar. I would like to have the message : "looking for networks" and then when the network is found it should then display the available networks. How do I obtain this?
I am relatively new to X-code and OS X so please try to be elaborate.
Thank you

Controlling state of Sony Camera qx100 (turning on, off) programmatically?

I would like to know if it is possible to turn on the sony camera dsc-qx100 (or qx10) programmatically or if it is mandatory to turn it on manually ?
Also, is it possible to control the period before the camera turns off ?
My idea is to be able to switch between two cameras and it seems that if I don't connect to one for a while, it will turning off automatically (My test on playMemories app gives me four minutes before it turns off).
Is there a way to avoid that ?
Thanks
Controlling the power state is not possible programatically.
This is not controllable either.
(My test on playMemories app gives me four minutes before it turns
off). Is there a way to avoid that ?
On some models it is possible to programmatically change autoPowerOff time or to deactivate it. Look for setAutoPowerOff.

Deciding if external display is activated or not

I'd like to be able to decide if the display on the computer where my app is running is currently active or shutdown. I need this for a media center software so I know if I need to activate the display before starting the playback of movies.
So far I tried to use this code:
CGError err0 = CGDisplayNoErr;
CGError err1 = CGDisplayNoErr;
CGDisplayCount dspCount = 0;
err0 = CGGetActiveDisplayList(0, NULL, &dspCount);
CGDisplayCount onlineCount = 0;
err1 = CGGetOnlineDisplayList(0, NULL, &onlineCount);
// Error handling omitted for clarity ;)
NSLog(#"Found %d active and %d online displays", dspCount, onlineCount);
But this code out puts always the same. When I try it on my mac mini, with the display turned off I get the following output:
Found 1 active and 1 online displays
The display is not in a standby mode as I disconnect the power to it when it is not in use. I also tried this on my mac book, which has an internal and an external display. And there it returns:
Found 2 active and 2 online displays
Here it is the same, I deactivate the display and disconnect the power to it but is still returns as beeing active.
The display on the mac mini is a tv-set connected with a dvi to hdmi cable. The display on the mac book is connected with a dvi to vga connector.
I hope somebody has an idea how to solve this. Thanks in advance.
It sounds like you want to know whether any connected display is asleep or not?
Have you looked at the CGDisplayIsAsleep function?
http://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/c/func/CGDisplayIsAsleep
To close this open question. My final findings were that as soon as an external monitor is connected to the computer the given methods will return that it is there. And this also works when the monitor is powered of and not connected to the power source.
So as far as I can tell there is no way to find out what I would like to know :(
As I control the event which activates the monitor from my application (in my case its a TV which I control with a usb to ir box) I can get the state of the monitor in this way, but this only has the downside that when the application is crashing, I will lose the state. But thats the best solution I could find.