In: Computer Science
Clarify the differences between the types of location sensors built-in to the mobile device. And how the Location information is accessed within an app?
There are many variety of sensors available when it comes to Mobile device and they are widely categorised into three different types namely:
1)Motion Sensors - It measures the acceleration force along
three axis. Some of examples are :accelerometers,
gravity sensors,
gyroscopes
2)Environmental Sensors - It measure environmental parameters such
as temperature, light etc. Some of the
exmaples are : barometers,
photometers, and thermometers.
3)Position Sensors - It measures the physical positions. Example
:
magnetometers
I will try to list down some of the widely used sensors below:
Fingerprint sensors - Now a days it is widely used to lock and unlock of phone and many applications. The sensor is most convenient to use, as it does not require swiping in order to read fingerprint data.
Accelerometer - It measures the acceleration that the handset is experiencing relative to freefall, also used to determine a device's orientation along its three axes.
Gyroscope - It is a sensor that provide orientation information with greater precision.
Magnetometer - It is used to detect magnetic fields.
Proximity sensor - It is placed near the earpiece of a phone. During a call, this sensor lets the system know that you're most probably in a call and that the screen has to be turned off.
Light sensor - It measures how bright the ambient light is. The phone's software uses this data to adjust the display's brightness automatically.
Barometer - It measures atmospheric pressure. Data measured by it is used to determine how high the device is above sea level, which in turn results in improved GPS accuracy.
Thermometer - It measures ambient temperature. Some handsets might have more than one of them(to monitor the temperature inside the device and its battery)
Pedometer - It is a sensor used for counting the number of steps that the user has taken.
Touch screen, GPS, Cameras and Microphones can be considered as sensors as well.
Coming to the secon part of the question. How the Location information is accessed within an app?
Let say, you are a developer and you want to build an app which
can communicate with Google Map.
So, google gives your application access to the location services
supported by the device through classes in the "android.location"
package. The central component of the location framework is the
LocationManager system service, which provides APIs to determine
location and bearing of the underlying device (if available).The
key class in the Google Maps Android API is "MapView". A MapView
displays a map with data obtained from the Google Maps service.
For example, if your app helps to determine best pubs within a radius of 20 miles from the location of the user, there are few ways to do it:
User asks the application to find the pubs around his location without specifying his position data. First of all, the application identifies where the user is actually located – the first API is involved. Once geolocation is identified, the user sees the map where the nearest pubs are marked – the second API is involved.
User asks the application to find the pubs around a certain location which are manually entered (e.g., particular address provided). In this case, the first API is not involved as there is no need to identify the geolocation information. It is already identified by the user. Thus, the application will interact with a mobile OS only via the second API to get the pubs displayed on the map.