{"id":25536660,"date":"2022-08-06T02:20:56","date_gmt":"2022-08-05T20:50:56","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25536660"},"modified":"2025-06-01T20:21:12","modified_gmt":"2025-06-01T14:51:12","slug":"explain-sensors-in-android-types-and-examples","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/","title":{"rendered":"Sensors in Android: Types and Examples"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e2fa7d7fc34\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e2fa7d7fc34\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#Introduction_What_are_Sensors_in_Android\" >Introduction: What are Sensors in Android?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#The_Android_Sensor_Framework\" >The Android Sensor Framework<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#Types_of_Sensors_in_Android\" >Types of Sensors in Android<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#Android_Simple_Sensor_App_Example\" >Android Simple Sensor App Example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<p>While buying a phone, you must have come across its specifications about sensors. But, what are they actually? This blog talks in detail about sensors in Android devices and applications, their types, and examples.<\/p>\n<p><em>Check out this video by Entri in Malayalam!<\/em><\/p>\n<div class=\"epyt-video-wrapper\"><iframe loading=\"lazy\"  style=\"display: block; margin: 0px auto;\"  id=\"_ytid_89110\"  width=\"480\" height=\"270\"  data-origwidth=\"480\" data-origheight=\"270\"  data-relstop=\"1\" src=\"https:\/\/www.youtube.com\/embed\/hFQEjbNw03k?enablejsapi=1&autoplay=0&cc_load_policy=0&cc_lang_pref=&iv_load_policy=1&loop=0&rel=0&fs=0&playsinline=1&autohide=2&theme=dark&color=red&controls=1&disablekb=0&\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Introduction_What_are_Sensors_in_Android\"><\/span><strong>Introduction: What are Sensors in Android?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy, and are useful if you want to monitor three-dimensional device movement or positioning, or you want to monitor changes in the ambient environment near a device.<\/p>\n<figure id=\"attachment_25613096\" aria-describedby=\"caption-attachment-25613096\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-25613096\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-300x300.png\" alt=\"android 15\" width=\"300\" height=\"300\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-300x300.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-150x150.png 150w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-24x24.png 24w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-48x48.png 48w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-96x96.png 96w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg-75x75.png 75w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Android_15_Developer_Preview_logo.svg.png 330w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-25613096\" class=\"wp-caption-text\">Android 15 Developer Preview<br \/>Source: Wikipedia<\/figcaption><\/figure>\n<p>For example, a game might track readings from a device&#8217;s gravity sensor to infer complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device&#8217;s temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to report a compass bearing.<\/p>\n<div class=\"devsite-article-body clearfix \">\n<p>The Android platform supports three broad categories of sensors:<\/p>\n<ul>\n<li><strong>Motion sensors<\/strong>: These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.<\/li>\n<li><strong>Environmental sensors<\/strong>: These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.<\/li>\n<li><strong>Position sensors<\/strong>: These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.<\/li>\n<\/ul>\n<p>You can access sensors available on the device and acquire raw sensor data by using the Android sensor framework. The sensor framework provides several classes and interfaces that help you perform a wide variety of sensor-related tasks. For example, you can use the sensor framework to do the following:<\/p>\n<ul>\n<li>Determine which sensors are available on a device.<\/li>\n<li>Determine an individual sensor&#8217;s capabilities, such as its maximum range, manufacturer, power requirements, and resolution.<\/li>\n<li>Acquire raw sensor data and define the minimum rate at which you acquire sensor data.<\/li>\n<li>Register and unregister sensor event listeners that monitor sensor changes.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/entri.app\/course\/flutter-training-in-kerala\/\" target=\"_blank\" rel=\"noopener\"><strong>Thinking about developing an app? Create one with Entri&#8217;s Flutter training course!<\/strong><\/a><\/p>\n<h2 id=\"sensors-intro\" role=\"presentation\" data-text=\"Introduction to Sensors\"><span class=\"ez-toc-section\" id=\"The_Android_Sensor_Framework\"><\/span><strong><span class=\"devsite-heading\" role=\"heading\">The Android Sensor Framework<\/span><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The Android sensor framework lets you access many types of sensors. Some of these sensors are hardware-based and some are software-based. <strong>Hardware-based sensors<\/strong> are physical components built into a handset or tablet device. They derive their data by directly measuring specific environmental properties, such as acceleration, geomagnetic field strength, or angular change.<\/p>\n<p><strong>Software-based sensors<\/strong> are not physical devices, although they mimic hardware-based sensors. Software-based sensors derive their data from one or more of the hardware-based sensors and are sometimes called virtual sensors or synthetic sensors. The linear acceleration sensor and the gravity sensor are examples of software-based sensors.<\/p>\n<p>Few Android-powered devices have every type of sensor. For example, most handset devices and tablets have an accelerometer and a magnetometer, but fewer devices have barometers or thermometers. Also, a device can have more than one sensor of a given type. For example, a device can have two gravity sensors, each one having a different range.<\/p>\n<h3 id=\"sensor-framework\" role=\"presentation\" data-text=\"Sensor Framework\"><strong><span class=\"devsite-heading\" role=\"heading\">Sensor Framework Classes and Interfaces<\/span><\/strong><\/h3>\n<p>You can access these sensors and acquire raw sensor data by using the Android sensor framework. The sensor framework is part of the\u00a0<code>android.hardware<\/code>\u00a0package and includes the following classes and interfaces:<\/p>\n<dl>\n<dt><code>SensorManager<\/code><\/dt>\n<dd>You can use this class to create an instance of the sensor service. This class provides various methods for accessing and listing sensors, registering and unregistering sensor event listeners, and acquiring orientation information. This class also provides several sensor constants that are used to report sensor accuracy, set data acquisition rates, and calibrate sensors.<\/dd>\n<dd>You can get the instance of SensorManager by calling the method getSystemService() and passing the SENSOR_SERVICE constant in it.<\/dd>\n<dt><code>Sensor<\/code><\/dt>\n<dd>You can use this class to create an instance of a specific sensor. This class provides various methods that let you determine a sensor&#8217;s capabilities.<\/dd>\n<dt><code>SensorEvent<\/code><\/dt>\n<dd>The system uses this class to create a sensor event object, which provides information about a sensor event. A sensor event object includes the following information: the raw sensor data, the type of sensor that generated the event, the accuracy of the data, and the timestamp for the event.<\/dd>\n<dt><code>SensorEventListener<\/code><\/dt>\n<dd>You can use this interface to create two call-back methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes.<\/dd>\n<dd>\n<table class=\"alt\">\n<tbody>\n<tr>\n<th>Public and abstract methods<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td><b>void onAccuracyChanged(Sensor sensor, int accuracy)<\/b><\/td>\n<td>it is called when sensor accuracy is changed.<\/td>\n<\/tr>\n<tr>\n<td><b>void onSensorChanged(SensorEvent event)<\/b><\/td>\n<td>it is called when sensor values are changed.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/dd>\n<\/dl>\n<p>In a typical application you use these sensor-related APIs to perform two basic tasks:<\/p>\n<ul>\n<li>\n<h4><strong>Identifying sensors and sensor capabilities: <\/strong><\/h4>\n<\/li>\n<\/ul>\n<p>Identifying sensors and sensor capabilities at runtime is useful if your application has features that rely on specific sensor types or capabilities. For example, you may want to identify all of the sensors that are present on a device and disable any application features that rely on sensors that are not present. Likewise, you may want to identify all of the sensors of a given type so you can choose the sensor implementation that has the optimum performance for your application.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-25613072 aligncenter\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-300x169.webp\" alt=\"android\" width=\"336\" height=\"189\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-300x169.webp 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-1024x576.webp 1024w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-768x432.webp 768w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-150x84.webp 150w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-750x422.webp 750w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1-1140x641.webp 1140w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/09\/simplified-android-robot-icon-1.webp 1536w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><\/p>\n<ul>\n<li>\n<h4><strong>Monitor sensor events: <\/strong><\/h4>\n<\/li>\n<\/ul>\n<p>Monitoring sensor events is how you acquire raw sensor data. A sensor event occurs every time a sensor detects a change in the parameters it is measuring. A sensor event provides you with four pieces of information: the name of the sensor that triggered the event, the timestamp for the event, the accuracy of the event, and the raw sensor data that triggered the event.<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/entri.app\/course\/flutter-training-in-kerala\/\" target=\"_blank\" rel=\"noopener\">Become an Android App Developer with Entri&#8217;s Flutter training course! Join Now!<\/a><\/strong><\/p>\n<h3 id=\"sensor-availability\" role=\"presentation\" data-text=\"Sensor Availability\"><strong><span class=\"devsite-heading\" role=\"heading\">Sensor Availability<\/span><\/strong><\/h3>\n<p>While sensor availability varies from device to device, it can also vary between Android versions. This is because the Android sensors have been introduced over the course of several platform releases. For example, many sensors were introduced in Android 1.5 (API Level 3), but some were not implemented and were not available for use until Android 2.3 (API Level 9).<\/p>\n<p>Likewise, several sensors were introduced in Android 2.3 (API Level 9) and Android 4.0 (API Level 14). Two sensors have been deprecated and replaced by newer, better sensors. Only four platforms are listed because those are the platforms that involved sensor changes. Sensors that are listed as deprecated are still available on subsequent platforms (provided the sensor is present on a device), which is in line with Android&#8217;s forward compatibility policy.<\/p>\n<\/div>\n<h2 class=\"h2\"><span class=\"ez-toc-section\" id=\"Types_of_Sensors_in_Android\"><\/span><strong>Types of Sensors in Android<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Below are the different types of sensors in Android.<\/p>\n<p>Android supports three types of sensors:<\/p>\n<h4 class=\"h4\"><strong>1) Motion Sensors<\/strong><\/h4>\n<p>These are used to measure acceleration forces and rotational forces along with three axes.<\/p>\n<h4 class=\"h4\"><strong>2) Position Sensors<\/strong><\/h4>\n<p>These are used to measure the physical position of device.<\/p>\n<h4 class=\"h4\"><strong>3) Environmental Sensors<\/strong><\/h4>\n<p>These are used to measure the environmental changes such as temperature, humidity etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-25613159 aligncenter\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-300x300.webp\" alt=\"sensors in android\" width=\"378\" height=\"378\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-300x300.webp 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-150x150.webp 150w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-24x24.webp 24w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-48x48.webp 48w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-96x96.webp 96w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-75x75.webp 75w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1-350x350.webp 350w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/34719-1.webp 675w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\" \/><\/p>\n<h2 class=\"h3ex\"><span class=\"ez-toc-section\" id=\"Android_Simple_Sensor_App_Example\"><\/span><strong>Android Simple Sensor App Example<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s see the two sensor examples.<\/p>\n<ul>\n<li>\n<h3><strong>A sensor example that prints x, y and z axis values.<\/strong><\/h3>\n<\/li>\n<\/ul>\n<h4><strong>Input<\/strong>:<\/h4>\n<p><code>#include &lt;Wire.h&gt;<br \/>\n#include &lt;MPU6050.h&gt;<br \/>\nMPU6050 mpu;<br \/>\nvoid setup() {<br \/>\nSerial.begin(9600);<br \/>\nWire.begin();<br \/>\nmpu.initialize();<br \/>\nif (!mpu.testConnection()) {<br \/>\nSerial.println(\"MPU6050 connection failed\");<br \/>\nwhile (1);<br \/>\n}<br \/>\nSerial.println(\"MPU6050 connection successful\");<br \/>\n}<br \/>\nvoid loop() {<br \/>\nint16_t ax, ay, az;<br \/>\nmpu.getAcceleration(&amp;ax, &amp;ay, &amp;az);<br \/>\nSerial.print(\"X: \"); Serial.print(ax);<br \/>\nSerial.print(\" | Y: \"); Serial.print(ay);<br \/>\nSerial.print(\" | Z: \"); Serial.println(az);<br \/>\ndelay(500);<br \/>\n}<\/code><\/p>\n<h4><strong>Output:<\/strong><\/h4>\n<p><code>MPU6050 connection successful<br \/>\nX: 123 | Y: -245 | Z: 16234<br \/>\nX: 118 | Y: -248 | Z: 16240<br \/>\nX: 120 | Y: -250 | Z: 16236<br \/>\nX: 122 | Y: -247 | Z: 16232<br \/>\nX: 119 | Y: -249 | Z: 16238<br \/>\n<\/code><\/p>\n<ul>\n<li>\n<h3><strong>A sensor example that changes the background color when device is shuffled.<\/strong><\/h3>\n<\/li>\n<\/ul>\n<h4><strong>Input:<\/strong><\/h4>\n<p><code>#include &lt;Wire.h&gt;<br \/>\n#include &lt;MPU6050.h&gt;<br \/>\n#include &lt;Adafruit_GFX.h&gt;<br \/>\n#include &lt;Adafruit_SSD1306.h&gt;<br \/>\n#define SCREEN_WIDTH 128<br \/>\n#define SCREEN_HEIGHT 64<br \/>\n#define OLED_RESET -1<br \/>\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);<br \/>\nMPU6050 mpu;<br \/>\nbool inverted = false;<br \/>\nvoid setup() {<br \/>\nSerial.begin(9600);<br \/>\nWire.begin();<br \/>\n\/\/ Initialize MPU6050<br \/>\nmpu.initialize();<br \/>\nif (!mpu.testConnection()) {<br \/>\nSerial.println(\"MPU6050 connection failed\");<br \/>\nwhile (1);<br \/>\n}<br \/>\nSerial.println(\"MPU6050 connected\");<br \/>\n\/\/ Initialize display<br \/>\nif (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {<br \/>\nSerial.println(F(\"SSD1306 allocation failed\"));<br \/>\nwhile (1);<br \/>\n}<br \/>\ndisplay.clearDisplay();<br \/>\ndisplay.setTextSize(2);<br \/>\ndisplay.setTextColor(SSD1306_WHITE);<br \/>\ndisplay.setCursor(0, 0);<br \/>\ndisplay.println(\"Ready\");<br \/>\ndisplay.display();<br \/>\n}<br \/>\nvoid loop() {<br \/>\nint16_t ax, ay, az;<br \/>\nmpu.getAcceleration(&amp;ax, &amp;ay, &amp;az);<br \/>\n\/\/ Calculate total acceleration vector magnitude<br \/>\nfloat totalAccel = sqrt(ax * ax + ay * ay + az * az);<br \/>\n\/\/ Shake threshold - tune as needed (around 20000 is a strong shake)<br \/>\nif (totalAccel &gt; 20000) {<br \/>\ninverted = !inverted; \/\/ toggle display inversion<br \/>\ndisplay.invertDisplay(inverted);<br \/>\ndisplay.clearDisplay();<br \/>\ndisplay.setCursor(0, 0);<br \/>\ndisplay.setTextSize(2);<br \/>\ndisplay.setTextColor(SSD1306_WHITE);<br \/>\ndisplay.println(\"Shaken!\");<br \/>\ndisplay.display();<br \/>\ndelay(1000); \/\/ debounce<br \/>\n}<br \/>\ndelay(100); \/\/ poll rate<br \/>\n}<\/code><\/p>\n<h4><strong>Output:<\/strong><\/h4>\n<table>\n<thead>\n<tr>\n<th>Time<\/th>\n<th>Event<\/th>\n<th>Display Appearance<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0s<\/td>\n<td>Power on<\/td>\n<td>&#8220;Ready&#8221; (black bg, white text)<\/td>\n<\/tr>\n<tr>\n<td>Shake #1<\/td>\n<td>Detected<\/td>\n<td>&#8220;Shaken!&#8221; (white bg, black text)<\/td>\n<\/tr>\n<tr>\n<td>Shake #2<\/td>\n<td>Detected<\/td>\n<td>&#8220;Shaken!&#8221; (black bg, white text)<\/td>\n<\/tr>\n<tr>\n<td>Shake #3<\/td>\n<td>Detected<\/td>\n<td>&#8220;Shaken!&#8221; (white bg, black text)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"text-align: center;\"><strong><a href=\"https:\/\/entri.app\/course\/flutter-training-in-kerala\/\" target=\"_blank\" rel=\"noopener\">Master Android app development with Entri. Enrol now to elevate your career!<\/a><\/strong><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Android devices are equipped with a lot of sensors that gives it a chance to interact with the physical world. Android app developers can actually leverage the Android Sensor API to create innovative and precise-functioning applications. It is safe to say that understanding of these sensors, their types, and examples, is crucial to build applications that seamlessly enhance the user experience. You can literally thrive in the world of app development with these sensors as one of your assets. Happy coding!<\/p>\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\">\n<p style=\"text-align: center;\"><b>Related articles<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/entri.app\/blog\/flutter-vs-android-studio-whats-the-difference\/\" target=\"_blank\" rel=\"noopener\">Flutter Vs Android Studio: What\u2019s the Difference?<\/a><\/strong><\/p>\n<\/td>\n<td>\n<p class=\"jeg_post_title\" style=\"text-align: center;\"><a href=\"https:\/\/entri.app\/blog\/major-skills-for-android-developer\/\" target=\"_blank\" rel=\"noopener\"><strong>Major Skills for Android Developer<\/strong><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/entri.app\/blog\/what-is-the-difference-between-linux-and-android\/\" target=\"_blank\" rel=\"noopener\">What is the Difference between Linux and Android?<\/a><\/strong><\/p>\n<\/td>\n<td>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/entri.app\/blog\/all-about-android-latest-version-android-12\/\" target=\"_blank\" rel=\"noopener\">All About Android Latest Version: Android 15<\/a><\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><a href=\"https:\/\/entri.app\/blog\/learning-android-development\/\" target=\"_blank\" rel=\"noopener\"><strong>Learning Android Development In 2025<\/strong><\/a><\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/entri.app\/blog\/what-is-an-sdk-in-android-with-definitiontypes-and-benefits\/\" target=\"_blank\" rel=\"noopener\"><strong>What Is An SDK in Android? (With Definition,Types And Benefits)<\/strong><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>While buying a phone, you must have come across its specifications about sensors. But, what are they actually? This blog talks in detail about sensors in Android devices and applications, their types, and examples. Check out this video by Entri in Malayalam! Introduction: What are Sensors in Android? Most Android-powered devices have built-in sensors that [&hellip;]<\/p>\n","protected":false},"author":111,"featured_media":25613160,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1903,2155],"tags":[],"class_list":["post-25536660","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-coding","category-flutter"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Sensors in Android: Types and Examples - Entri Blog<\/title>\n<meta name=\"description\" content=\"Learn the role of sensors in Android devices and applications along with their different types and examples!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sensors in Android: Types and Examples - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"Learn the role of sensors in Android devices and applications along with their different types and examples!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-05T20:50:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-01T14:51:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Feeba Mahin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Feeba Mahin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\"},\"author\":{\"name\":\"Feeba Mahin\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\"},\"headline\":\"Sensors in Android: Types and Examples\",\"datePublished\":\"2022-08-05T20:50:56+00:00\",\"dateModified\":\"2025-06-01T14:51:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\"},\"wordCount\":1357,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp\",\"articleSection\":[\"Articles\",\"Coding\",\"Flutter\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\",\"url\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\",\"name\":\"Sensors in Android: Types and Examples - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp\",\"datePublished\":\"2022-08-05T20:50:56+00:00\",\"dateModified\":\"2025-06-01T14:51:12+00:00\",\"description\":\"Learn the role of sensors in Android devices and applications along with their different types and examples!\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp\",\"width\":820,\"height\":615,\"caption\":\"sensors in android\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Flutter\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/flutter\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Sensors in Android: Types and Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\",\"name\":\"Feeba Mahin\",\"url\":\"https:\/\/entri.app\/blog\/author\/feeba123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sensors in Android: Types and Examples - Entri Blog","description":"Learn the role of sensors in Android devices and applications along with their different types and examples!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/","og_locale":"en_US","og_type":"article","og_title":"Sensors in Android: Types and Examples - Entri Blog","og_description":"Learn the role of sensors in Android devices and applications along with their different types and examples!","og_url":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-08-05T20:50:56+00:00","article_modified_time":"2025-06-01T14:51:12+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp","type":"image\/webp"}],"author":"Feeba Mahin","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Feeba Mahin","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/"},"author":{"name":"Feeba Mahin","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36"},"headline":"Sensors in Android: Types and Examples","datePublished":"2022-08-05T20:50:56+00:00","dateModified":"2025-06-01T14:51:12+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/"},"wordCount":1357,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp","articleSection":["Articles","Coding","Flutter"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/","url":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/","name":"Sensors in Android: Types and Examples - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp","datePublished":"2022-08-05T20:50:56+00:00","dateModified":"2025-06-01T14:51:12+00:00","description":"Learn the role of sensors in Android devices and applications along with their different types and examples!","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-4-2.webp","width":820,"height":615,"caption":"sensors in android"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/explain-sensors-in-android-types-and-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Flutter","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/flutter\/"},{"@type":"ListItem","position":4,"name":"Sensors in Android: Types and Examples"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36","name":"Feeba Mahin","url":"https:\/\/entri.app\/blog\/author\/feeba123\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25536660"}],"version-history":[{"count":10,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536660\/revisions"}],"predecessor-version":[{"id":25613161,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536660\/revisions\/25613161"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25613160"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25536660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25536660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25536660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}