iOS Development Sensors

Source: Internet
Author: User

sensorWhat is a sensor?

Sensor is a sensing \ detection device , which is widely used in smartphones.

the role of the sensor

For sensing \ Testing equipment around the information

Different types of sensors , the detection of information is not the same

The following behavior in the IPhone is done by the sensor

In the map application , you can judge the direction of the shot head.

A turn off the light, the IPhone will automatically reduce the brightness to make the screen look less dazzling

When you call, the face is close to the iPhone screen , the screen will automatically lock the screen to achieve the purpose of saving electricity

... ...

type of sensor

the sensors built into the iPhone5 are

  • Motion sensor \ acceleration sensor \ Accelerometer (motion/accelerometer sensor)
  • Ambient light sensor (Ambient)
  • Distance sensors (Proximity sensor)
  • magnetometer Sensors (magnetometer sensor)
  • Internal temperature sensor (Internal temperature sensor)
  • Humidity sensors (moisture sensor)
  • Gyroscope (Gyroscope)
  • ... ...
Ambient light sensor (Ambient)

Is the oldest sensor member in IOS and Mac devices

It allows you to have more comfortable eyes when using your Mac, IPhone, IPad

After walking from a bright outdoor to a relatively dark room, theiOS device will automatically turn down the brightness, making the screen look less shiny and dazzling .

When you use the iPhone to take pictures, the flash will automatically open under certain conditions

Almost all Macs have backlit keyboards that automatically turn on the keyboard backlight when the surrounding light is weak to certain conditions

distance Sensors (Proximity sensor)

Used to detect if there are other objects near the device screen

When you call or answer the phone with the phone screen close to your ear, theiPhone automatically turns off the screen, and the advantage is

Save Power

Prevents unwanted accidental action by accidentally touching the screen with the ear or face

Off-topic: Using distance sensors, you can find a lot of TV's wearing lens

magnetometer Sensors (magnetometer sensor)
    • Can sense the Earth's magnetic field, get direction information, make location service data more accurate
    • Can be used for electronic compass and navigation applications
    • the Smart Cover Lid sleep operation of the IPad is based on a magnetometer sensor

internal temperature sensor (Internal temperature sensor)

starting with the IPad generation,IOS devices incorporate an internal temperature sensor that detects the internal component temperature, and when the temperature exceeds the system-set threshold , the following prompt appears

Internal temperature sensor for improving the security and stability of IOS devices is a great help

Humidity Sensors (moisture sensor)

Unlike other microelectronics-based sensors, humidity sensors are a simple physical sensor

In a nutshell, a humidity sensor is a strip of water that turns red.

Apple 's maintenance staff is to determine if the device is flooded by checking that the test paper turns red.

(Equipment water is not covered under warranty)

Gyroscope (Gyroscope)
    • Gyroscopes are the first sensors to appear on iOS devices with IPhone4 's listing
    • Gyroscope can be used to test the holding mode of the equipment
    • The gyroscope's principle is to detect the angular velocity at which the device rotates on the X,Y,Z axes .

Gyroscopes play a major role in racing games:

Simulate steering wheel rotation when driving a car

Makes the control experience of this kind of game more real

motion sensor \ acceleration sensor \ Accelerometer (motion/accelerometer sensor)

one of the first sensors that appears on an IOS device

Accelerometers are used to detect the acceleration of the device on the X,Y,Z axes (which is a powerful action)

Accelerometers can be used to detect the shaking of equipment, classic application scenarios

    • Shake a Shake
    • Pedometer
Sensor Summary

Sensor type

Role

Ambient light sensor

Sensing ambient light intensity (automatically adjusts screen brightness)

Distance sensor

Sensing if there are other objects near the device screen (call Auto lock screen)

Magnetometer sensor

Sensing the surrounding magnetic field (co-Gai)

Internal temperature sensor

Sensing the temperature inside the device (reminding the user to cool down, preventing damage to the device)

Humidity sensor

Whether the induction equipment is flooded (to facilitate maintenance personnel)

Gyroscope

Holding mode of induction equipment (racing games)

Acceleration meter

Motion of induction equipment (shaking, pedometer)

use of distance sensors
1 //Open Range Sensing function2[Uidevice currentdevice].proximitymonitoringenabled =YES;3 //Notification of listening distance sensing4 [[Nsnotificationcenter Defaultcenter] addobserver:self5 selector: @selector (proximitychange:)6 name:uideviceproximitystatedidchangenotification7 Object: nil];8 9- (void) Proximitychange: (Nsnotificationcenter *) Notification {Ten     if([uidevice Currentdevice].proximitystate = =YES) { OneNSLog (@"an object is close to the device screen");//The screen will automatically lock A}Else { -NSLog (@"an object is away from the device screen");//The screen will automatically unlock -     } the}

iOS Development Sensors

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.