0% found this document useful (0 votes)
8 views9 pages

mad_lab_file[1]

Uploaded by

rahjat91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views9 pages

mad_lab_file[1]

Uploaded by

rahjat91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

A

Report

On

Mobile Development Application

Submitted to Submitted to

Mrs. Shikha Gupta Priyanka Meena(22cs90)

Professor Rahul Bagaria(22cs95)

(CSE Department) Shanu kumar mangal(22cs101)

Department of Computer Science & Engineering

GOVT. ENGINEERING COLLEGE, AJMER

Badliya Circle, NH-08, Ajmer

1
Introduction
The application is written in Kotlin and designed for Android devices. Its primary purpose is
to retrieve and display a list of all available hardware sensors, such as the accelerometer,
gyroscope, and proximity sensor. This application helps users understand the sensors their
device supports, which can be useful for testing or learning.

Code Structure and Functionality

The main parts of the code include:

1. Package Declaration: Specifies that the app belongs to a group of code files in the
"com.example.devicesensors" package.
2. Imports:
o Tools to interact with device hardware (e.g., Sensor Manager and Sensor).
o The AppCompatActivity class, which helps manage activities in Android.
o TextView, used to display text on the screen.
3. MainActivity Class: This is the heart of the application. It:
o Sets up the layout when the app starts.
o Uses SensorManager to interact with hardware sensors.
o Displays sensor information on the screen using a TextView.

How the Code Works (Step-by-Step)

1. Setup:
o The app begins by initializing the activity when the user opens it.
o The user interface is linked to a layout file, which contains a TextView for
displaying the sensor list.
2. Initialize SensorManager:
o The code accesses Android's hardware system services using
getSystemService.

2
o A SensorManager object is created, which acts as the gateway to all hardware
sensors.

3. Retrieve Sensor List:


o Using the getSensorList method, the app fetches details about all available
sensors on the device.
4. Display Sensor Information:
o The app uses a TextView to show sensor details like type (e.g.,
"Accelerometer"), vendor (manufacturer), and version.
o It loops through the sensor list, appending each sensor's information to the
TextView.

Execution Flow

Here’s what happens when the app runs:

1. Start the App:


o The MainActivity class is loaded.
o The app's layout is prepared, with a TextView to display sensor data.
2. Retrieve Sensors:
o The app fetches the list of all sensors available on the device.
3. Display Information:
o Sensor details are shown on the screen in a user-friendly format.

Output

The application displays:

• A comprehensive list of all hardware sensors.


• Details such as the sensor type (e.g., gyroscope, light sensor), vendor, and version.

3
Applications and Benefits

• Educational Use: Useful for developers and students to understand hardware


sensors on Android devices.
• Diagnostics: Helps check if a device has specific sensors or if they are functioning
properly.
• Testing: Developers can verify the presence of sensors before building sensor-based
apps.

Limitations

• Dependency on Layout:
o If the TextView in the layout is missing or misconfigured, the app will crash.
• Unfiltered Data:
o Displays raw sensor information, which may be overwhelming for non-
technical users.

Suggestions for Improvement

1. Group Sensors by Type:


o Categorize sensors into "Motion", "Position", and "Environmental" for better
readability.
2. Add Descriptions:
o Provide user-friendly explanations for each sensor.
3. Error Handling:
o Ensure the app doesn’t crash if the layout or sensors are missing.
4. Export Data:
o Allow users to save the sensor list for external use or further analysis.

4
Flowchart

5
Pseudocode

Pseudocode for Sensor Listing Application:

START
1. Initialize SensorManager:
a. Use getSystemService(Context.SENSOR_SERVICE) to retrieve SensorManager
instance.

2. Retrieve List of Sensors:


a. Use sensorManager.getSensorList (Sensor.TYPE_ALL) to fetch all available sensors.

3. Find TextView:
a. Use findViewById (R.id.tv) to locate the TextView in the layout.

4. Iterate Over Sensor List:


FOR each sensor in the sensor list DO:
Append sensor.toString () to the TextView.

5. Display Sensor Information:


a. The TextView will now show all sensor details.

END

6
Source code

7
Output

8
Conclusion

The app effectively demonstrates how to use Android’s SensorManager to interact with
hardware sensors. It’s simple and functional, making it a great starting point for developers.
With a few enhancements, it could become a comprehensive tool for sensor diagnostics and
learning.

You might also like