About Ambient Light sensor in iphone - iphone

Thanks in advance.
I got the information about the iphone sensors from http://ipod.about.com/od/ipodiphonehardwareterms/qt/iphone-sensors.htm. But I didn't get information about how to use ambient sensor in iphone

Here's a link to a description of the ambient light sensor hardware with example code that shows how to access it.

It is possible, and the framework is public.
You can activate the connection to the sensor like so :
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES];
BTW, it doesn't seem to be using the light sensor, because proximity sensing would tweak out in a dark room.
However, the API call basically blanks the screen when you hold the phone up to your face. Not useful for interaction, sadly.
Here is a guide about iPhone sensors :
iPhone sensors

Related

It is possible to record video in iPhone device screen off mode?

Am working in iPhone device camera based iOS application. I have one requirement to record video from our application even the device screen is off or in locked. I don't have iPhone, iPod and iPad. And also i don't know it is possible to record video in these conditions. Cound you please give me any idea on this? Looking forward your help. Thanks in advance.
No this is not possible. There's no other way to achieve this.
In some countries it's against the law to even take picture without sound effect, such as Japan for example. No wonder Apple don't allow to shoot pictures from locked screen.

Find device orientation using Accelerometer data x,z,y

How can we find the device orientation from x,y,z(accelerometer).
I was trying to get the device orientation by identifying the x,y,z values but it differs. I'm getting different values for iPhone,iPad. Is there any way to find using Accelerometer because I'm using this for background app. UIDeviceOrientation will not work for background app.
Thanks in advance.

How to implement an iOS metal detector app?

I want to implement a Metal Detector app which will react to a magnetic field in the phones surroundings.
How do I read the magnetic field readings from the magnetometer on the iPhone? Does anyone have sample code for accessing the magnetometer readings directly?
Thanks!
I would recommend you look at the O'Reilly book called iOS Sensor that is coming out. They have an entire chapter (6) on the magnetometer and a sample app.
iOS Sensor Programming
Apple Sample Code for Reading the Raw Values from the Magnetometer
No. You can't.
UPDATE : there is no metal detecting components in iPhone. However, there is a magnetometer available since iPhone 3GS. The Compass App makes use of the sensor to detect direction. It just reads magnetic North, but not reading magnetic fields surrounding. Therefore, you can't make a metal detector with it.
Physics Fact: Metal does not generate magnetic fields. Magnets do.
p.s. correct me if I am wrong.
There is already an app which does this. Check this and this blog.
This is what the description says,
The app has an adjustable sensitivity and makes an audible sound
signal if the sensitivity reaches a medium level. The phone needs to
be shook once to be calibrated if you intend to use the device again.
The app makes use of the magnetometer on the iPhone to find
interference with the compass to detect metal objects. Just hover the
backside of your mobile, the area under the camera, over the metal and
the app should find the metal and there should be an increase in
sensitivity.
However I am not sure if it is a fake app or it can be really done this way. Try downloading that and check it yourself. It is a free app.

html5 and heat sensors

I'm new to html5 programming and was thinking of building an html5 app for iphone. I was wondering if there was any information in the API about sensing temperature on touch in the api? My app depends on the temperature of ones finger when they touch the screen. Is there anyway to measure this? IF not, is there a way to measure the amount of pressure applied to the screen?
Thanks!
Room temperature: Yes.
The temperature of your thumb on the iPhone screen: no.
The pressure of your thumb on the screen: also no.
Remember - the iPhone "touch" works on capacitance, not "mechanical pressure".

iOS4 iPhone turn screen off, keep accelerometer on

I know this has been asked before, but the answers that I see are 2 years back. So I'll rephrase the question: are there any new power management APIs in iOS4 that I can take advantage of to turn off the screen?
-Overlaying a black view on top of an existing view still drives the screen's backlight and refresh rate.
Can I let the device screen timeout normally and then run my app in the background? I need to collect accelerometer data.
Thank you!
As far as I know you can't collect accelerometer data while the phone is locked. Also there are no power management APIs.
I found this for you tho where they give a trick of using proximity sensor but that doesn't seem like a reasonable solution. Enable iPhone accelerometer while screen is locked