android - Dynamic Detection of Hand Movement using Accelerometer -


i want detect movement of hand dynamically , modify sound accordingly. phone in hand in fixed orientation not change. example, holding phone in stretched hand , moves right or left, music volume changes dynamically; if move , down speed of playing changes , moving @ intermediate angle changes both speed , volume accordingly. charted accelerometer data while doing these motions , there seems pattern not sure how filter those. have looked @ lot of posts - high pass/low pass filters, kalman filters, gesture recognizers difficult understand appropriate method. of posts don't seem detect dynamically - when gesture finished. need use accelerometer , not gyroscope , other sensor. correct approach here? there existing libraries this?

if activity implements

sensoreventlistener 

and use variables

private sensormanager sensormanager; private sensor maccelerometer; 

in oncreate() instantiate them , register listener this:

sensormanager = (sensormanager) getsystemservice(context.sensor_service); maccelerometer = sensormanager.getdefaultsensor(sensor.type_accelerometer); sensormanager.registerlistener(this, maccelerometer,                 sensormanager.sensor_delay_fastest); 

and use method accelerometer data

 public void onsensorchanged(sensorevent event) {          double x = event.values[0];         double y = event.values[1];         double z = event.values[2]; } 

and can take there depending on values accelerometer, make changes volume or whatever


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -