i would like to know if a sensor (for exemple the accellerometer) is present on my Android device.
I am dealing with the SensorManager class. Here is the code I am using:
sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorMgr.registerListener(this,sensorMgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),1);
Thank you.
take a look in here:
http://developer.android.com/reference/android/content/pm/PackageManager.html
if think you need to do that:
PackageManager manager = getPackageManager();
boolean hasAccelerometer = manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);