Thursday, June 19, 2014

Week 4: Lesson 7: Integrating Sensors Into Java For Android

Lesson 7: Integrating Sensors Into Java For Android
INTRODUCTION
In this lesson you will learn more about relative layouts and how these can accommodate a variety of different content in your application. You will also be introduced to the variety of sensors available for Android mobile application hardware and software and how they function based on motion or environmental conditions. Within this lesson you will also be introduced to the Accelerometer Motion sensor and will learn how to integrate it into your application.

LESSON OBJECTIVES
By the end of this lesson, you will be able to:
Section #1: Understanding Sensors in Java For Android
1.     Summarize the use of sensors in mobile applications.
Section #2: Understanding Relative Layouts
1.     Summarize the benefits of a relative layout.
Section #3: Video Demonstration: Relative Layouts & Integration Accelerometer Sensor

LEARNING SEQUENCE

Required Reading
Read the following:
·      Section #1:




·      Section #2:
Resources
View the following: 
·      Sample Code
·      Video Transcripts
Assignments
Complete the following:
·      What are sensors in mobile applications and how are they used to interpret information from the world around them?
·       What are the benefits of using a relative layout for your application?  Why are positioning views important in a relative layout? What do they do?

INSTRUCTION

Section #1: Understanding Sensors in Java For Android

In this section, you will be introduced to what sensors on applications are and how they can be integrated into Android applications. You will learn how motion sensors work and how to integrate the Accelerometer sensor into an Android application. You will also be introduced to the SensorEvent class which supports the integration of the sensors into Java for Android.

Step 1.
Read the Sensors Overview provided by Android. This reading will explain the three main types of sensors, included motion, environmental and position sensors and how these have been integrated into Android application development. The reading provides an overview of the sensor framework, classes and interfaces that help you to perform different types of sensor-related tasks used on Android.

Step 2.
This web page describes the variety of motion sensors available with Java for Android. This reading will describe the difference between hardware- and software-based sensors and outlines how motion sensors can be used to monitor device movement (tilt, shake, rotation and swing) from direct user input. The page also reviews the application of motion sensors for reading device movement. A list of motion sensors available on the Android platform is provided with descriptions. This page also introduces you to the Using the Accelerometer. 

Step 3.
The section on the Accelerometer sensor gives you a conceptual model and code examples of how to measure the acceleration applied to the device, including the force of gravity. The reading explains how the accelerometer can be used to monitor device motion and how pervasive it is in Android devices such as handsets and tablets. 

Step 4.
This is a class described for the use of a SensorEvent in your Java code. Use this document as a guide when implementing it into your code. It provides an overview and a sample.

Step 5.
Complete Assignment #1: Describe the intents that you see in your current mobile application.

Section #2: Understanding Relative Layouts
In this section you will understand how to create a relative layout and edit its attributes and then integrate it into a Java for Android project.

Step 1.
Use the reading provided to review what relative layouts are and how they can organize the content of your page. This reading provides the benefits of using a relative layout and how it can benefit the design of your application. This resource also provides the details of positioning views within the relative layout. A sample of the relative layout in XML is provided and will be useful to you as you complete the video tutorial. The additional sensors listed will assist you with future development projects.

Step 2.
Complete Assignment #2: What are the benefits of using a relative layout for your application? Why are positioning views important in a relative layout? What do they do?

Section #3: Video Demonstration of Relative Layouts & Integration Accelerometer Sensor

In this video you will create a new XML file for the Accelerometer and add the Accelerometer to the menu. You will also create the Java code for the Accelerometer and add the necessary activity code to the Android Manifest to have the Accelerometer run within the application.

Step 1.
View & Practice: Lesson 7 [12:33]

SUMMARY
In this lesson you have practiced using sensors in mobile application development using Java. You were provided an overview of how sensors interact with environmental factors, while you created the Java code for integrating an accelerometer sensor into your project. You also integrated a relative layout into your project and learned how the positioning views can adjust your project in the layout. In the next lesson you will learn how to integrate an image swiper into your application and. You will use the same process of creating an XML file by adding the item to the menu and creating the Java for the swiper to run.

ASSIGNMENTS
·      What are sensors in mobile applications and how are they used to interpret information from the world around them?

·      What are the benefits of using a relative layout for your application? Why are positioning views important in a relative layout? What do they do?


No comments:

Post a Comment