1. Android Sensor and
Framework - AWARE
Yucheng Jin, Sven Charleer, Robin De Croon
Joris Klerkx
Augment Human @ HCI
7 October 2015
2. Sensors
Hardware devices that measure the physical environment.
• Motion sensors
accelerometers, gravity sensors, gyroscopes, etc.
• Environmental sensors
barometers, photometers, and thermometers.
• Position sensors
GPS, orientation sensors and magnetometers.
3. Sensor Framework
Access sensors and and acquire raw sensor data.
Android Sensor Framework includes 3 abstract class and one interface.
• SensorManager
• Sensor
• SensorEvent
• SensorEventListener
http://developer.android.com/guide/topics/sensors/sensors_overview.html
• Identifying sensors and sensor capabilities
• Monitor sensor events
4. Sensor Framework - AWARE
AWARE is an Android instrumentation framework for logging, sharing
and reusing mobile context.
http://www.awareframework.com/
5. Overview of AWARE infrastructure
Ferreira, D., Kostakos, V., & Dey, A. K. (2015). AWARE: mobile context instrumentation framework. Frontiers in ICT, 2, 6.
6. Overview of AWARE client’s interfaces
Ferreira, D., Kostakos, V., & Dey, A. K. (2015). AWARE: mobile context instrumentation framework. Frontiers in ICT, 2, 6.
7. How to use AWARE in your app?
• Create a AWARE plugin
It runs on top of the AWARE app, AWARE need to be installed
beforehand.
(template)
http://www.awareframework.com/creating-a-new-aware-plugin/
• Creating a standalone application
It uses AWARE as a built-in library and leverages AWARE’s sensors’ and
plugins’ APIs.
8. Creating a standalone application
1. Adding AWARE as a
library to your
project.
2. Overriding
AWARE’s resources
with your
application’s
resources.
3. Include AWARE’s
ContentProviders
inside your
application.
4. Include AWARE’s
plugins inside your
application.(if
need)
http://www.awareframework.com/creating-a-standalone-application/
9. Saving sensor data
• Saving context data into a ContentProvider
ContentProvider can manage databases such as SQLite.
Sync data
Save data
http://www.awareframework.com/creating-a-context-provider/
class Plugin, onCreate()
10. Reading sensor data
Two ways of reading data
• Passive context
Accessing the data from the database when you need it
• Active context
- Listening to data changes
- Listening to new values
http://www.awareframework.com/how-do-i-read-data/#read1
12. Active context
Reading new data from the database when it gets inserted
http://www.awareframework.com/how-do-i-read-data/#read1
In the class Plugin
13. Active context
Reading the new data as it gets broadcasted by a sensor
http://www.awareframework.com/how-do-i-read-data/#read1
onCreate(), onResume()
In the class Plugin
onReceive()
14. Practice
• AWARE
Follow the link to create a standalone application with sensors or the plugin “Google Fused
Location”
http://www.awareframework.com/creating-a-standalone-application/#
http://www.awareframework.com/plugin/82/
or create your own plugin
http://www.awareframework.com/creating-a-new-aware-plugin/
More tutorial
http://www.awareframework.com/category/tutorials/
• Original android sensor doc
Modify the app and show the actual values of listed sensors on your device.
http://www.tutorialspoint.com/android/android_sensors.htm
http://developer.android.com/guide/topics/sensors/sensors_overview.html
measure acceleration forces and rotational forces along three axes
ambient air temperature and pressure, illumination, and humidity
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.
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.
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.
You can use this interface to create two callback methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes.
AWARE provides application developers with user’s context using AWARE’s API.
AWARE provides application developers with user’s context using AWARE’s API.
AWARE provides application developers with user’s context using AWARE’s API.
read new data from the database when it gets inserted
read the new data as it gets broadcasted by a sensor
read new data from the database when it gets inserted
read the new data as it gets broadcasted by a sensor
Also, its important that you unregister the observer in the onDestroy() method of your plugin so that your plugin does not cause memory leaks