Thanks Peli, it works like a charm now! In fact my compass code needed no adaptation, but it was very nice to simulate it to make sure. Your demo sample was particularly helpful. Great stuff! Before I had just not realized that I had to download the documentation bundle rather than read the various pieces of online material. Thanks for clarifying that.
Regards Long P.S.: I just wished that the Java language purists would not have prevented having a C-like preprocessor (#ifdef, etc) such that I could more easily, and with physical certainty, remove all OpenIntents traces and dependencies after testing. I prefer physical code stripping over any assurances of transparency. Right now I have to comment out code in five places. Doable after adding unique searchable OpenIntents tags to those various places, but not convenient. This is not an OpenIntents problem, of course. I hope that someone will figure out how to add a C preprocessor to Eclipse for working with Android. On Sep 9, 12:52 am, Peli <[EMAIL PROTECTED]> wrote: > Sorry, yes I have not updated the old m5 documentation. > > Everything is well documented in the samples/ApiDemosSensors though. > > You have to replace this: > ---------- > mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); > ---------- > by this: > ======== > // Before calling any of the Simulator data, > // the Content resolver has to be set !! > Hardware.mContentResolver = getContentResolver(); > > // Link sensor manager to OpenIntents Sensor simulator > mSensorManager = (SensorManager) new > SensorManagerSimulator((SensorManager) > getSystemService(SENSOR_SERVICE)); > ======== > > By default this still passes the original sensor values, so to > activate sensors you have to first call (to set the sensor settings): > ------- > Intent intent = new Intent(Intent.ACTION_VIEW, > Hardware.Preferences.CONTENT_URI); > startActivity(intent); > --------- > > and then > --------- > // first disable the current sensor > mSensorManager.unregisterListener(mGraphView); > > // now connect to simulator > SensorManagerSimulator.connectSimulator(); > > // now enable the new sensors > mSensorManager.registerListener(mGraphView, > SensorManager.SENSOR_ACCELEROMETER | > SensorManager.SENSOR_MAGNETIC_FIELD | > SensorManager.SENSOR_ORIENTATION, > SensorManager.SENSOR_DELAY_FASTEST); > --------- > > Then just implement the android SensorListener (there is no OI > counterpart necessary). > > I hope this helps (and I hope I will find time to update the outdated > documentation - sorry for the confusion). > > Peli --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

