Hi,

I want to write a program that can respond to events sensed by
accelerometer. I have the openIntents.jar in my classpath. Also, I
have a simple activity, onCreate() of which has the following lines of
code:

/////////////////////////////////////

mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Hardware.mContentResolver = getContentResolver();
mSensorManager = (SensorManager) new SensorManagerSimulator(
                                
(SensorManager)getSystemService(SENSOR_SERVICE));


mSensorManager.unregisterListener(this);
SensorManagerSimulator.connectSimulator();

mSensorManager.registerListener(this,
                        SensorManager.SENSOR_ACCELEROMETER ,
                        SensorManager.SENSOR_DELAY_UI);

/////////////////////////////////////

The activity implements the SensorListener Interface and the
onSensorChanged event is coded as follows:

public void onSensorChanged(int sensor, float[] values) {

Log.d("MSG","Acceleromoter detected");
}

When, I run my application and check logcat, i see Log.d() messages
written continuously even when i am not simulating any movements of
the device using the openIntents simulator. the javadoc for
onSensorChanged() reads:
"Called when sensor values have changed. The length and contents of
the values array vary depending on which sensor is being
monitored...."

Is this behavior normal? Am i missing something?




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to