*** ANSWER: As pointed by DeeV, this question was already covered here. I can't figure out how to close this question as DUPLICATE
I have been testing with motion detection and I have had good results. But there is one small error that I have absolutely no idea how to troubleshoot. When I implement the following:
public class MainActivity extends Activity implements SensorEventListener
private SensorManager mSensorManager;
// ... OnCreate..
mSensorManager = (SensorManager) getSystemService(this.SENSOR_SERVICE);
On any activity, it executes well on android devices with androd 2.1-upate1, an 4.0.3. On the emulator however, it only works on 4.0.3. On 2.1 The virtual device simply hangs on execution, on logcat there is no message. Removing this line:
mSensorManager = (SensorManager) getSystemService(this.SENSOR_SERVICE);
Then allows the activity to start.
I now the issue must be my environment; I reainstalled sdk but the problem remains.I have only tried this in my pc. Who can give me an idea of what is happening?