I want to intercept sensor events in Android and override (fix) transmitted data. Is it possible?

The solution should work for all applications using that sensor.


I need to override magnetometer and accelerometer.

  • What sensors are you talking about? The GPS? Cell signal? Accelerometers? GPS can be faked, not sure about cell, and accelerometers (and most other sensors) would likely require a kernel modification or a custom driver.
    – Stephen S
    Feb 4, 2013 at 15:12
  • I need to override magnetometer and accelerometer.
    – Suzan Cioc
    Feb 4, 2013 at 15:49
  • Is this a development question? Rather, as dymutaos pointed out, a custom kernel/driver would be needed to override the sensors, with the current Android API, its dubious if you can do so.
    – t0mm13b
    Feb 4, 2013 at 16:00
  • Then tell something about custom drivers. Is this require rooting? Or such drivers can normally be developed and distributed by third-party designers?
    – Suzan Cioc
    Feb 4, 2013 at 16:11
  • Drivers are written by the hardware manufacturers. They are the only ones who know exactly what is needed for their particular hardware. If all you wanted to do was emulate hardware, you could probably write your own driver (similar to how some remote desktop clients write their own mouse and keyboard drivers). Blocking or intercepting existing hardware, however, would involve reverse engineering the current driver. At any rate, all options require programming, which is outside of the scope for this site.
    – Stephen S
    Feb 4, 2013 at 16:30

1 Answer 1


No, you cannot natively override the magnetometer and accelerometer sensors. Android does not have an API for this (as opposed to GPS), and faking these signals would require programming a custom driver or kernel. It isn't a simple matter of getting root and changing a simple config file somewhere.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .