Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 Schrauger Feb 4 '13 at 15:12
I need to override magnetometer and accelerometer. – Suzan Cioc Feb 4 '13 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 '13 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 '13 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 Schrauger Feb 4 '13 at 16:30

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.