android - I'm using onSensorChanged(). What should I specify in <uses-feature>? -


i've checked doc here: http://developer.android.com/guide/topics/manifest/uses-feature-element.html

and found 2 relevant features:

1) android.hardware.sensor.accelerometer

2) android.hardware.sensor.compass

which 1 need specify in manifest? or both?

yes, i'm sure i'm using accelerometer. accelerometer , magnetic field values used calculate "direction" (which means i'm using android.hardware.sensor.compass ??)

here's code:

@override  public void onsensorchanged(sensorevent event) {   int type = event.sensor.gettype();    switch (type) {   case sensor.type_magnetic_field:    mags = event.values.clone();    break;                //i'm using accelerometer here   case sensor.type_accelerometer:    accels = event.values.clone();                         break; }                     sensormanager.getrotationmatrix(rotationmat, i, accels, mags);    sensormanager.getorientation(rotationmat, calculatedorients);                 //i direction here,  need specify android.hardware.sensor.compass in <uses-feature> ?    azimuth = (float) math.todegrees(calculatedorients[0]);    pitch = (float) math.todegrees(calculatedorients[1]);    roll = -(float) math.todegrees(calculatedorients[2]); } 

thank in advance!

i think answer , should use both.

make sure can set required false , have application write notice user. else might not able distribute older clients through android market.

<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" /> <uses-feature android:name="android.hardware.sensor.compass" android:required="true" /> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -