I am building a application for the Android platform and I would like to use the accelerometer. Now, I have found a very nice application for sensor simulation (OpenIntents’ SensorSimulator) but, for what I want to do, a would like to create my own sensor simulator application.
I have not found information on how to do this (I do not know if disassembly the jar of the Simulator is correct) and, as I said, I would like to build a smaller and simpler version of a sensor simulator, more suitable for my intents.
Do you know where could I start? where can I see what are the pieces of code that I need to build?
Basically, all my asking just for some direction.
Well, it seems what you want to make is a application that will emulate the sensors on a Android device for your application while testing on the emulator.
Probably in your application, you have a line like this:
Why not create a interface that has the methods you use from SensorManager:
And then create a wrapper for SensorManager that just calls those methods on a real SensorManager object:
And then create another MySensorManager, that this time communicates over a socket to a desktop application you will create where you enter the sensor values or something:
And finally, replace your first line:
With a new line:
Now you can just use that object instead of the SensorManager you used before.