Is possible to simulate an event on a Android real device?

More precisely, I want to test an application which does something if a particular temperature value is detected. Is there an adb command, or somethings else, to send a fake sensor value to the device in order to check the application behaviour?



Specifically what sensor ? If you are simulating a screen press, then yes.

If you are simulating a temperature for your CPU, probably not.

It depends on the level of safety In my opinion, if your just mocking GPS locations, not a big problem... However if your trying to mock temperature readings or something that might cause hardware failure's... it may not be possible.

  • Unfortunately I would be interested at temperature and pressure sensors.
    – matz_
    Feb 24 '19 at 22:48
  • I'm fairly sure for user safety reasons, that this is the hardest form of sensor data mocking. Feb 24 '19 at 23:22
  • For example, a CPU set to 0° temperature, could potentially expose your lithium based battery to unnecessary heat, that could potentially end in a life threatening situation or an extremely dangerous one... Lithium mixed with oxygen creates explosive gas, the heat source ( CPU ) is usually directly under the battery compartment and ... If the correct situations are met, goodbye hand, or face, or stomach... i personally was interested in a CPU Cooking software that I was trying to build for tests, however it's extremely hard to mock temperature readings... Pressure readings may also be risky Feb 24 '19 at 23:27
  • I understand the subject, but I don't think that the environmental temperature may be cause this problem, but i don't understand why Google doesn't provide some way to simulate these values as well.
    – matz_
    Feb 24 '19 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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