Vijay Kumar Kolagani Dr. Yingcai Xiao

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 4 Overview Overview of Sensors Programming Tutorial 1: Tracking location with GPS and Google.
Advertisements

Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
2. Setting Up Your Android Development Environment.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Setting up the Development Environment Copyright © SUPINFO. All rights reserved Preparation.
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
CS378 - Mobile Computing Sensing and Sensors. Sensors "I should have paid more attention in Physics 41" Most devices have built in sensors to measure.
CS378 - Mobile Computing Sensing and Sensors. Sensors "I should have paid more attention in Physics 41" Most devices have built in sensors to measure.
Android Sensors & Async Callbacks Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Android Programming By Mohsen Biglari Android Programming, Part1: Introduction 1 Part1: Introduction By Mohsen Biglari.
Lecture # 9 Hardware Sensor. Topics 2  SensorManger & Sensor  SensorEvent & SensorEventListener  Example Application.
Sensing. Possible sensors on devices – Documented in SensorEvent class Accelerometer (m/s 2 ) – acceleration in x, y, z axes Magnetic Field (micro Tesla)
Operating system for mobile devices with a Java programming interface. Provides tools, e.g. a compiler, debugger, device emulator, and its own Java Virtual.
Doodlz App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
DUE Hello World on the Android Platform.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Presented By: Muhammad Tariq Software Engineer Android Training course.
Sensors – Part I SE 395/595.
CS378 - Mobile Computing Sensing and Sensors Part 2.
Introduction to Android
 Installation of Android Development Environment  Creating the App with OpenGL ES API  Running the App on Emulator Android App Development.
Sensors in android. App being more applicable Keeping track of your heart beat while jogging. Pointing the phone camera towards the night sky to know.
Sensors Nasrullah Khan Niazi. Using Device Sensors The Android SDK provides access to raw data from sensors on the device.The sensors,and their precision.
TODAY Android Studio Installation Getting started Creating your 1 st App Beginning to understanding Intents.
Sensors For Mobile Phones  Ambient Light Sensor  Proximity Sensor  GPS Receiver Sensor  Gyroscope Sensor  Barometer Sensor  Accelerometer Sensor.
Installation of Visual Studio Android emulator and Android Studio
CS378 - Mobile Computing Sensing and Sensors Part 2.
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors Date: Feb 11, 2016.
Understanding Mobile Devices, Interactions, and Tools Lesson 1.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
CPE 490/590 – Smartphone Development
CHAPTER 8 Sensors and Camera. Chapter objectives: Understand Motion Sensors, Environmental Sensors and Positional Sensors Learn how to acquire measurement.
CS371m - Mobile Computing Sensing and Sensors.
The Doodlz app enables you to paint by dragging one or more fingers across the screen. The app provides options for setting the drawing color.
Guide To Develop Mobile Apps With Titanium. Agenda Overview Installation of Platform SDKs Pros of Appcelerator Titanium Cons of Appcelerator Titanium.
Introduction to Android Programming
Android Android Sensors Android Sensors: – Accelerometer – Gravity sensor – Linear Acceleration sensor – Magnetic Field sensor – Orientation.
Android Programming.
Sensors in Android.
Vijay Kumar Kolagani Dr. Yingcai Xiao
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors
Mobile Device Development
PhoneGap, Processing.
Android Mobile Application Development
Sai Goud Durgappagari Dr. Yingcai Xiao
Android.
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors.
Development-Introduction
Sensors, maps and fragments:
CS499 – Mobile Application Development
CMPE419 Mobile Application Development
CS371m - Mobile Computing Sensing and Sensors.
Programming HCI Yingcai Xiao Yingcai Xiao.
Automation for mobile apps Presenter: Nikita Mader
Sai Goud Durgappagari, VIJAY KOLAGANI, Dr. Yingcai Xiao
Vijay Kumar Kolagani Dr. Yingcai Xiao
CS323 Android Getting Started
More ISP At a Glance.
Android Developer Fundamentals V2
Android Topics Sensors Accelerometer and the Coordinate System
Android Programming Tutorial
Professional Environment
Introduction to AppInventor
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors.
Mobile Programming Sensors in Android.
Android Platform, Android App Basic Components
CMPE419 Mobile Application Development
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Vijay Kumar Kolagani Dr. Yingcai Xiao Android Vijay Kumar Kolagani Dr. Yingcai Xiao

Architecture of Smart Phone APPS

Programming Smart Phone APPS: OO-EDP Smart phones are computers that support advanced HCI (Human Computer Interaction), more than just GUI. HCI: input, output Input: A/V, touch, sensors, remote, composite events (key entry), … Output: screen, mirroring, VR, haptic, text (Internationalization), … EDP: implement event-handlers. Look for interested input events to start. OOP: Android apps written in Java (object-oriented), so look for needed parent classes to start.

Development Tools Android software are developed with IDEs (Integrated Development Environment). Java Development Kit (JDK) http://www.Oracle.Com/technetwork/java/javase/downloads/index-jsp-138363.Html Android Software Development Kit includes the Eclipse Android IDE / Android Studio and the Android Development Toolkit (ADT) Eclipse for Android developers : http://www.Eclipse.Org/downloads/eclipse-packages/ Android Studio : https://developer.Android.Com/studio/index.html

Programming Using Android Studio IDE

Setup Android Studio Android studio : https://developer.Android.Com/studio/index.html For Macs, download the dmg file and open it to install. Select standard installation. Start Android Studio. Select an existing sample (say, Universal Music Player). Update any components when asked to do so. Try other examples in the studio.

Setup Android Studio To interact with your Android phone on a computer, download the Vysor Chrome app. https://chrome.google.com/webstore/detail/vysor/gidgenkbbabolejbgbpnhbimgjbffefm?hl=en-US On your Android phone: Settings Develop options (if your don’t see the options, go to “About Phone”, click “Build number” several times until it says you are now a developer. :-). Turn on USB Debugging Connect you phone to the computer’s USB port. Now go to Chrome (After installing the plugin) chrome://apps/ Select Vysor When asked on the phone for connection type: select MIDI

EDP: Input/EVENTS

Android Interactions Voice Control Touch Screen Sensor Control

Sensors Overview The Android platform supports three broad categories of sensors: Motion sensors: these sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors. Environmental sensors: these sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers. Position sensors: these sensors measure the physical position of a device. This category includes, GPS, orientation sensors and magnetometers.

OOP: Classes

Sensor Framework The sensor framework is part of the android.Hardware package and includes the following classes and interfaces: Sensormanager 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. Sensor You can use this class to create an instance of a specific sensor. This class provides various methods that let you determine a sensor's capabilities. Sensorevent 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. Sensoreventlistener You can use this interface to create two callback methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes.

OO-EDP Identifying sensors and sensor capabilities. To use sensor-related APIs we perform two basic tasks: Identifying sensors and sensor capabilities. Write handlers for identified events/sensors by extending existing classes.

Identifying sensors and sensor capabilities Create an instance of the sensormanager class by calling the getsystemservice() method and passing in the sensor_service argument. We can determine whether A specific type of sensor exists on A device by using the getdefaultsensor() method and passing in the type constant for A specific sensor for example: private SensorManager mSensorManager; ... mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); if (mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null){ // Success! There's a Accelerometer. } else { // Failure! No Accelerometer. }

Monitoring Sensor Events To monitor raw sensor data you need to implement two callback methods that are exposed through the sensoreventlistener interface: onaccuracychanged() and onsensorchanged() this methods are called whenever the following occurs: A sensor's accuracy changes. In this case the system invokes the onaccuracychanged() method, providing you with a reference to the sensor object that changed and the new accuracy of the sensor. Accuracy is represented by one of four status constants SENSOR_STATUS_ACCURACY_LOW, SENSOR_STATUS_ACCURACY_MEDIUM,SENSOR_STATUS_ACCURACY_HIGH, or SENSOR_STATUS_UNRELIABLE. A sensor reports a new value. In this case the system invokes the onsensorchanged() method, providing you with a sensorevent object. A sensorevent object contains information about the new sensor data, including: the accuracy of the data, the sensor that generated the data, the timestamp at which the data was generated, and the new data that the sensor recorded.

Accelerometer It measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity. Public void onsensorchange(sensorevent sensorevent) {     sensor mysensor = sensorevent.Sensor;       If (mysensor.Gettype() == sensor.Type_accelerometer) {         float x = sensorevent.Values[0];         Float y = sensorevent.Values[1];         Float z = sensorevent.Values[2];     } }

Map Example Start Android Studio Start a new project Select the Map project from the examples Import anything it asks you Two files will be generated: google_map_api.xml MapsActivity.java Run->Run ‘app’ (the paly button). It will ask you create an emulator if you have not done so. Select a smart phone to emulate.

Map Example

Resources Resources are non-coding elements of the application String resources (for Internationalization) Configuration resources (for GUI setting and DB connections) Get a Google Map key by following the instructions in google_map_api.xml Modify the google_maps_key. Run ‘app’ again. <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyD-eK-tf32qnGIS4RueDX09aG6EuyZclnE</string>

Resources

Using Unity

Check if it is android platform or not #if UNITY_ANDROID Currentplatformandroid = true; #Else Currentplatformandroid = false; #Endif Measure linear acceleration of a device in three-dimensional space. Input.Acceleration.X; // X axis Input.Acceleration.Y; // Y axis Input.Acceleration.Z; // Z axis

References https://code.tutsplus.com/tutorials/using-the-accelerometer-on-android-- mobile-22125 https://developer.android.com/about/versions/nougat/index.html https://docs.unity3d.com/ScriptReference/Input-acceleration.html