Programming for Mobiles - Practical 3



Audio recording

Use the AudioRecord class to record sound.

Device orientation

You should collect a sensor reading from the accelerometers (Sensor.TYPE_ACCELEROMETER) and from the magnetic field sensor (Sensor.TYPE_MAGNETIC_FIELD). Then pass these values to SensorManager.getRotationMatrix - this method combines the two sensor readings to give you a rotation matrix from the device coordinate system to the global coordinate system. You can now pass this rotation matrix to SensorManager.getOrientation which projects the matrix to compute azimuth, pitch and roll.

Android Accessory Development Kit

Full information from the google website is available online. See src/com/google/android/apps/adk2/activity/ for an example of how to connect to the Clock application (preinstalled on the device) with Bluetooth and the getSensors and handleGetSensors methods to collect information