accelerometer - Unexpected false return value from android.hardware.SensorManager.registerListener in Android 4.3 -


used lg nexus 4, android 4.3

the return value false , don't understand why. documentation says: "true if sensor supported , enabled."

what strange no examples i've seen testing return value sensormanager.registerlistener.

strange if ignore false value returned works expected!

documentation: http://developer.android.com/reference/android/hardware/sensormanager.html

android.hardware.sensormanager, android.hardware.systemsensormanager

my code:

sensormanager sensormgr = (sensormanager)_context.getsystemservice(context.sensor_service); if (sensormgr == null) {     log.w(tag, "200410::sensors not supported");     return false; }  sensor sensor = sensormgr.getdefaultsensor(sensor.type_proximity); result = sensormgr.registerlistener(this, sensor, sensormanager.sensor_delay_normal); if( result == false) {     // should done here     // since false return value indicated registration failed.     // found it's better doing nothing since registration seams ok } return result; 

the strange false return value did not happened before android 4.3

so, ok if result value not used in examples. maybe should satisfied that, but, have 3 questions:

  1. why return value never tested in examples?
  2. why return value false in android 4.3?
  3. why working if return value false?

i understand these questions difficult answer happy if info else have same problem.

i got same behavior both sensor.type_accelerometer , sensor.type_proximity


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -