SlideShare a Scribd company logo
1 of 20
Android	
  Sensors	
  
Jussi	
  Pohjolainen	
  
Overview	
  
•  SensorManager:	
  Access	
  to	
  sensors	
  if	
  
hardware	
  supports	
  
•  SensorEventListener:	
  Interface	
  for	
  class	
  to	
  
listen	
  sensor	
  values	
  as	
  they	
  change	
  in	
  =me	
  
SensorManager
•  Access	
  to	
  device’s	
  sensors	
  
•  Reference	
  by	
  calling	
  getSystemService
•  Disable	
  sensors	
  if	
  you	
  don’t	
  need	
  them!	
  (drain	
  
baEery)	
  
	
  
Sensor	
  Type	
  
•  Accelerometer,	
  Orienta=on	
  
•  Light	
  
•  Magne=c	
  field	
  
•  Proximity	
  
•  Temperature	
  
•  …	
  
	
  
Sampling	
  Rate	
  
•  How	
  fast	
  try	
  to	
  get	
  the	
  sensor	
  data	
  
•  Reques=ng	
  specific	
  sampling	
  rate..	
  Hint	
  to	
  the	
  
system,	
  no	
  guarantees	
  
•  SensorManager	
  holds	
  constant	
  variables:	
  
– Fastest	
  
– Game	
  
– Normal	
  
– User	
  Interface	
  
	
  
Accuracy	
  
•  How	
  accurate	
  is	
  the	
  informa=on?	
  
– High	
  
– Low	
  
– Medium	
  
– Unreliable	
  
•  This	
  is	
  informa=on	
  is	
  sent	
  to	
  listener	
  
SensorManager	
  Example	
  
public class SensorActivity extends Activity implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mAccelerometer;
public SensorActivity() {
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
}
protected void onResume() {
super.onResume();
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
}
protected void onPause() {
super.onPause();
mSensorManager.unregisteredListener(this);
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent event) {
}
}
Sensor	
  Simulator	
  
•  The	
  current	
  Android	
  emulator	
  does	
  not	
  
support	
  sensors	
  
•  Use	
  Sensor	
  Simulator,	
  open	
  source	
  project	
  
developed	
  by	
  Open	
  Intents	
  
•  Supports	
  accelerometer,	
  compass,	
  
orienta=on,	
  and	
  temperature	
  sensors,	
  
•  Download	
  it	
  from: 	
  	
  
– hEp://code.google.com/p/openintents/wiki/
SensorSimulator	
  
Instruc=ons	
  
1.  Download	
  the	
  latest	
  sensorsimulator-
x.x.x.zip from	
  the	
  download	
  tab	
  and	
  unzip.	
  
2.  Start	
  bin/sensorsimulator-x.x.x.jar (Java	
  
standalone	
  applica=on).	
  
1.  java –jar sensorsimulator-x.x.x.jar
3.  Install	
  bin/SensorSimulatorSettings-
x.x.x.apk on	
  your	
  Android	
  emulator.	
  
4.  Launch	
  SensorSimulator	
  on	
  the	
  emulator.	
  
5.  Enter	
  IP	
  address	
  and	
  socket	
  (port)	
  number	
  into	
  
the	
  emulator	
  
2.	
  Start	
  the	
  Sensor	
  Simulator	
  Jar	
  
3.	
  Install	
  Sensor	
  Simulator	
  Apk	
  
4.	
  Launch	
  Sensor	
  Simulator	
  in	
  
Emulator	
  
5.	
  Configure	
  App	
  
6.	
  Enable	
  Connec=on	
  
Using	
  Sensor	
  Simulator	
  in	
  Your	
  App	
  
•  Add	
  external	
  JAR	
  lib/sensorsimulator-
lib.x.x.x.jar	
  to	
  your	
  project	
  
•  Use	
  sensorsimulator	
  classes	
  
•  Get	
  reference	
  to	
  SensorManagerSimulator	
  
instead	
  of	
  SensorManager	
  
•  Connect	
  to	
  simulator	
  
•  Add	
  permission	
  to	
  use	
  internet	
  
Add	
  .jar	
  to	
  Project	
  
Android Sensors
Android Sensors
Android Sensors

More Related Content

What's hot

Android Sensor and Framework - AWARE
Android Sensor and  Framework - AWAREAndroid Sensor and  Framework - AWARE
Android Sensor and Framework - AWAREDarrenJin
 
Fire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontrollerFire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontrollervibs1893
 
Design of Arduino based fire fighting Robot
Design of Arduino based fire fighting RobotDesign of Arduino based fire fighting Robot
Design of Arduino based fire fighting RobotNilanjan Mandal
 
Human presence detection based room light controller using pir2.pptx [repaired]
Human presence detection based room light controller using pir2.pptx [repaired]Human presence detection based room light controller using pir2.pptx [repaired]
Human presence detection based room light controller using pir2.pptx [repaired]nikhilsinghia
 
Sensors and its type by ss
Sensors and its type by ssSensors and its type by ss
Sensors and its type by sssundas Shabbir
 
Tk2323 lecture 10 sensor
Tk2323 lecture 10   sensorTk2323 lecture 10   sensor
Tk2323 lecture 10 sensorMengChun Lam
 
Fire Fighting Robot
Fire Fighting RobotFire Fighting Robot
Fire Fighting RobotSaadullah74
 
IRJET- Fire Fighting Robot using Arduino
IRJET- Fire Fighting Robot using ArduinoIRJET- Fire Fighting Robot using Arduino
IRJET- Fire Fighting Robot using ArduinoIRJET Journal
 
IRJET-Android Controlled Firefighting Robot using Arduino
IRJET-Android Controlled Firefighting Robot using ArduinoIRJET-Android Controlled Firefighting Robot using Arduino
IRJET-Android Controlled Firefighting Robot using ArduinoIRJET Journal
 
Automatic fire fighting robot
Automatic fire fighting robotAutomatic fire fighting robot
Automatic fire fighting robotMaulikGoyani5
 
Fire Fighting Robot by saurabh
Fire Fighting Robot by saurabhFire Fighting Robot by saurabh
Fire Fighting Robot by saurabhSaurabh Kumar
 
Fire fighting robot
Fire fighting robot Fire fighting robot
Fire fighting robot vijay kumar
 
Fire fighting robot ppt
Fire fighting robot pptFire fighting robot ppt
Fire fighting robot pptathmeg
 
Automatic Fire Fighting Robot by St John College
Automatic Fire Fighting Robot by St John CollegeAutomatic Fire Fighting Robot by St John College
Automatic Fire Fighting Robot by St John CollegeNidhiRaut7
 

What's hot (20)

Android Sensor and Framework - AWARE
Android Sensor and  Framework - AWAREAndroid Sensor and  Framework - AWARE
Android Sensor and Framework - AWARE
 
Generic sensors for the Web
Generic sensors for the WebGeneric sensors for the Web
Generic sensors for the Web
 
Mobile Sensors
Mobile SensorsMobile Sensors
Mobile Sensors
 
Peno sensor
Peno sensorPeno sensor
Peno sensor
 
Fire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontrollerFire fighting robot using 8051 microcontroller
Fire fighting robot using 8051 microcontroller
 
Design of Arduino based fire fighting Robot
Design of Arduino based fire fighting RobotDesign of Arduino based fire fighting Robot
Design of Arduino based fire fighting Robot
 
Human presence detection based room light controller using pir2.pptx [repaired]
Human presence detection based room light controller using pir2.pptx [repaired]Human presence detection based room light controller using pir2.pptx [repaired]
Human presence detection based room light controller using pir2.pptx [repaired]
 
Mebin progress
Mebin progressMebin progress
Mebin progress
 
Sensors and its type by ss
Sensors and its type by ssSensors and its type by ss
Sensors and its type by ss
 
Tk2323 lecture 10 sensor
Tk2323 lecture 10   sensorTk2323 lecture 10   sensor
Tk2323 lecture 10 sensor
 
Fire Fighting Robot
Fire Fighting RobotFire Fighting Robot
Fire Fighting Robot
 
fire fighting robot
fire fighting robotfire fighting robot
fire fighting robot
 
IRJET- Fire Fighting Robot using Arduino
IRJET- Fire Fighting Robot using ArduinoIRJET- Fire Fighting Robot using Arduino
IRJET- Fire Fighting Robot using Arduino
 
Sensors by khaleel
Sensors by khaleelSensors by khaleel
Sensors by khaleel
 
IRJET-Android Controlled Firefighting Robot using Arduino
IRJET-Android Controlled Firefighting Robot using ArduinoIRJET-Android Controlled Firefighting Robot using Arduino
IRJET-Android Controlled Firefighting Robot using Arduino
 
Automatic fire fighting robot
Automatic fire fighting robotAutomatic fire fighting robot
Automatic fire fighting robot
 
Fire Fighting Robot by saurabh
Fire Fighting Robot by saurabhFire Fighting Robot by saurabh
Fire Fighting Robot by saurabh
 
Fire fighting robot
Fire fighting robot Fire fighting robot
Fire fighting robot
 
Fire fighting robot ppt
Fire fighting robot pptFire fighting robot ppt
Fire fighting robot ppt
 
Automatic Fire Fighting Robot by St John College
Automatic Fire Fighting Robot by St John CollegeAutomatic Fire Fighting Robot by St John College
Automatic Fire Fighting Robot by St John College
 

Viewers also liked

Smart Phone CPU
Smart Phone CPUSmart Phone CPU
Smart Phone CPU오석 한
 
Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Egor Elizarov
 
Android internals 08 - System start up, Media subsystem (rev_1.1)
Android internals 08 - System start up, Media subsystem (rev_1.1)Android internals 08 - System start up, Media subsystem (rev_1.1)
Android internals 08 - System start up, Media subsystem (rev_1.1)Egor Elizarov
 
Samsung processors: Exynos family
Samsung processors: Exynos familySamsung processors: Exynos family
Samsung processors: Exynos familySagar Patel
 
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Egor Elizarov
 
Android internals 02 - High-level architecture, version control system (rev_1.1)
Android internals 02 - High-level architecture, version control system (rev_1.1)Android internals 02 - High-level architecture, version control system (rev_1.1)
Android internals 02 - High-level architecture, version control system (rev_1.1)Egor Elizarov
 
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)Egor Elizarov
 
Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Egor Elizarov
 
Android Security, Signing and Publishing
Android Security, Signing and PublishingAndroid Security, Signing and Publishing
Android Security, Signing and PublishingJussi Pohjolainen
 
Android Http Connection and SAX Parsing
Android Http Connection and SAX ParsingAndroid Http Connection and SAX Parsing
Android Http Connection and SAX ParsingJussi Pohjolainen
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android DevelopmentJussi Pohjolainen
 
Android internals 03 - Build system, emulator (rev_1.1)
Android internals 03 - Build system, emulator (rev_1.1)Android internals 03 - Build system, emulator (rev_1.1)
Android internals 03 - Build system, emulator (rev_1.1)Egor Elizarov
 
Android Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionAndroid Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionJussi Pohjolainen
 

Viewers also liked (20)

Game controlling via android
Game controlling via androidGame controlling via android
Game controlling via android
 
Smart Phone CPU
Smart Phone CPUSmart Phone CPU
Smart Phone CPU
 
Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)
 
Android internals 08 - System start up, Media subsystem (rev_1.1)
Android internals 08 - System start up, Media subsystem (rev_1.1)Android internals 08 - System start up, Media subsystem (rev_1.1)
Android internals 08 - System start up, Media subsystem (rev_1.1)
 
Samsung processors: Exynos family
Samsung processors: Exynos familySamsung processors: Exynos family
Samsung processors: Exynos family
 
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
Android internals 01 - Basic concepts of mobile platforms (rev_1.1)
 
Android internals 02 - High-level architecture, version control system (rev_1.1)
Android internals 02 - High-level architecture, version control system (rev_1.1)Android internals 02 - High-level architecture, version control system (rev_1.1)
Android internals 02 - High-level architecture, version control system (rev_1.1)
 
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)
Android internals 04 - “Androdized” kernel, Bionic, Logging subsystem (rev_1.1)
 
Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)Android internals 06 - Binder, Typical subsystem (rev_1.1)
Android internals 06 - Binder, Typical subsystem (rev_1.1)
 
Android Security, Signing and Publishing
Android Security, Signing and PublishingAndroid Security, Signing and Publishing
Android Security, Signing and Publishing
 
Android Http Connection and SAX Parsing
Android Http Connection and SAX ParsingAndroid Http Connection and SAX Parsing
Android Http Connection and SAX Parsing
 
Qt Translations
Qt TranslationsQt Translations
Qt Translations
 
Responsive Web Site Design
Responsive Web Site DesignResponsive Web Site Design
Responsive Web Site Design
 
C# for Java Developers
C# for Java DevelopersC# for Java Developers
C# for Java Developers
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android Development
 
Building Web Services
Building Web ServicesBuilding Web Services
Building Web Services
 
Android Essential Tools
Android Essential ToolsAndroid Essential Tools
Android Essential Tools
 
Android internals 03 - Build system, emulator (rev_1.1)
Android internals 03 - Build system, emulator (rev_1.1)Android internals 03 - Build system, emulator (rev_1.1)
Android internals 03 - Build system, emulator (rev_1.1)
 
Review Multicore processing based on ARM architecture
Review Multicore processing based on ARM architectureReview Multicore processing based on ARM architecture
Review Multicore processing based on ARM architecture
 
Android Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionAndroid Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth Connection
 

Similar to Android Sensors

Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)Bruno Delb
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)Ahsanul Karim
 
Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013Adam Blum
 
Robotics unit3 sensors
Robotics unit3 sensorsRobotics unit3 sensors
Robotics unit3 sensorsJanarthanan B
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindiappsdevelopment
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorialSynapseindiappsdevelopment
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors APIeleksdev
 
roboticsunit3sensors and -201013084413.pptx
roboticsunit3sensors and -201013084413.pptxroboticsunit3sensors and -201013084413.pptx
roboticsunit3sensors and -201013084413.pptxDrPArivalaganASSTPRO
 
Sensing & Actuation.pptx
Sensing & Actuation.pptxSensing & Actuation.pptx
Sensing & Actuation.pptxtaruian
 
Using multitouch and sensors in Java
Using multitouch and sensors in JavaUsing multitouch and sensors in Java
Using multitouch and sensors in JavaIntel Software Brasil
 
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...Mysa Vijay
 
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...chaitanya ivvala
 
Developing Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksDeveloping Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksFelipe Pedroso
 

Similar to Android Sensors (20)

Sensors 9
Sensors   9Sensors   9
Sensors 9
 
Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)Android Lab Test : Using the sensor gyroscope (english)
Android Lab Test : Using the sensor gyroscope (english)
 
Sensors in Android (old)
Sensors in Android (old)Sensors in Android (old)
Sensors in Android (old)
 
Android 1.8 sensor
Android 1.8 sensorAndroid 1.8 sensor
Android 1.8 sensor
 
Week12.pdf
Week12.pdfWeek12.pdf
Week12.pdf
 
Sensor Garage Door.pdf
Sensor Garage Door.pdfSensor Garage Door.pdf
Sensor Garage Door.pdf
 
Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013Sensing Mobile Devices talk from QCon London 2013
Sensing Mobile Devices talk from QCon London 2013
 
Robotics unit3 sensors
Robotics unit3 sensorsRobotics unit3 sensors
Robotics unit3 sensors
 
Making sense
Making senseMaking sense
Making sense
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorial
 
Android location and sensors API
Android location and sensors APIAndroid location and sensors API
Android location and sensors API
 
roboticsunit3sensors and -201013084413.pptx
roboticsunit3sensors and -201013084413.pptxroboticsunit3sensors and -201013084413.pptx
roboticsunit3sensors and -201013084413.pptx
 
Android sensor
Android sensorAndroid sensor
Android sensor
 
Sensing & Actuation.pptx
Sensing & Actuation.pptxSensing & Actuation.pptx
Sensing & Actuation.pptx
 
Advanced sensors in Series 40 Java ME apps
Advanced sensors in Series 40 Java ME appsAdvanced sensors in Series 40 Java ME apps
Advanced sensors in Series 40 Java ME apps
 
Using multitouch and sensors in Java
Using multitouch and sensors in JavaUsing multitouch and sensors in Java
Using multitouch and sensors in Java
 
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...
Mobile and Web Applications for Sensing Hazardous Room Temperature using Wire...
 
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING     OF AGRICULTURAL...
INTERNET OF THINGS IMPLEMENTATION FOR WIRELESS MONITORING OF AGRICULTURAL...
 
Developing Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for UltrabooksDeveloping Rich Interfaces in JavaFX for Ultrabooks
Developing Rich Interfaces in JavaFX for Ultrabooks
 

More from Jussi Pohjolainen

libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferencesJussi Pohjolainen
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 

More from Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Android Sensors

  • 1. Android  Sensors   Jussi  Pohjolainen  
  • 2. Overview   •  SensorManager:  Access  to  sensors  if   hardware  supports   •  SensorEventListener:  Interface  for  class  to   listen  sensor  values  as  they  change  in  =me  
  • 3. SensorManager •  Access  to  device’s  sensors   •  Reference  by  calling  getSystemService •  Disable  sensors  if  you  don’t  need  them!  (drain   baEery)    
  • 4. Sensor  Type   •  Accelerometer,  Orienta=on   •  Light   •  Magne=c  field   •  Proximity   •  Temperature   •  …    
  • 5. Sampling  Rate   •  How  fast  try  to  get  the  sensor  data   •  Reques=ng  specific  sampling  rate..  Hint  to  the   system,  no  guarantees   •  SensorManager  holds  constant  variables:   – Fastest   – Game   – Normal   – User  Interface    
  • 6. Accuracy   •  How  accurate  is  the  informa=on?   – High   – Low   – Medium   – Unreliable   •  This  is  informa=on  is  sent  to  listener  
  • 7. SensorManager  Example   public class SensorActivity extends Activity implements SensorEventListener { private SensorManager mSensorManager; private Sensor mAccelerometer; public SensorActivity() { mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) } protected void onResume() { super.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); } protected void onPause() { super.onPause(); mSensorManager.unregisteredListener(this); } public void onAccuracyChanged(Sensor sensor, int accuracy) { } public void onSensorChanged(SensorEvent event) { } }
  • 8. Sensor  Simulator   •  The  current  Android  emulator  does  not   support  sensors   •  Use  Sensor  Simulator,  open  source  project   developed  by  Open  Intents   •  Supports  accelerometer,  compass,   orienta=on,  and  temperature  sensors,   •  Download  it  from:     – hEp://code.google.com/p/openintents/wiki/ SensorSimulator  
  • 9. Instruc=ons   1.  Download  the  latest  sensorsimulator- x.x.x.zip from  the  download  tab  and  unzip.   2.  Start  bin/sensorsimulator-x.x.x.jar (Java   standalone  applica=on).   1.  java –jar sensorsimulator-x.x.x.jar 3.  Install  bin/SensorSimulatorSettings- x.x.x.apk on  your  Android  emulator.   4.  Launch  SensorSimulator  on  the  emulator.   5.  Enter  IP  address  and  socket  (port)  number  into   the  emulator  
  • 10. 2.  Start  the  Sensor  Simulator  Jar  
  • 11. 3.  Install  Sensor  Simulator  Apk  
  • 12. 4.  Launch  Sensor  Simulator  in   Emulator  
  • 15.
  • 16. Using  Sensor  Simulator  in  Your  App   •  Add  external  JAR  lib/sensorsimulator- lib.x.x.x.jar  to  your  project   •  Use  sensorsimulator  classes   •  Get  reference  to  SensorManagerSimulator   instead  of  SensorManager   •  Connect  to  simulator   •  Add  permission  to  use  internet  
  • 17. Add  .jar  to  Project