Recently, I have been working on a problem about gravity sensing, which involves the mobile phone's gravity sensing. I started to use a real machine for testing. The results have been tested for a long time and are not satisfactory, it has never been effective. In view of the trouble of using a real machine and connecting lines or something, I am going to use a simulated gravity sensor for the development of gravity sensing.
I have searched a lot of materials, which are basically the same. It is hard to understand in many places. the jar file is confusing, so developers may not know why. After a long time, they finally ran the gravity sensing demo. Here, they wrote every step of their work, for your reference. First, on the official website (http://code.google.com/p/androidjustice/downloads/detail? Name=sensorsimulator-1.0.0-beta1.zip&can=2&q;#download the sensorsimulator-1.0.0-beta1.zip file, which mainly includes the gravity sensing demo, the class sensorsimulator-lib.jar to be used by gravity sensing and the sensorsimulator. jar file for simulation data. Next, copy the sensordemo project under the samples folder and place it where you often create Android projects to facilitate project import. In the eclipse development zone, right-click and choose import, find the sensordemo project you just placed. If there is a problem with the project, check whether the project file is complete. For example, you cannot see the version file "android2.1" in the eclipse Development Zone (FAQs in the import project ), select buildpath → configure build path, switch to the android tab, select the corresponding Android version number, and click OK. This step completes the import of the sensordemo test project. Next, install the sensorsimulatorsettings.apk under the binfile folder to the simulator, which is equivalent to the receiver (or client, and then the sensorsimulator. jar is the server that controls all actions on the client.) open the jar file and check the IP address and port number boxes. Then, open the sensorsimulator in the bin folder of the download folder. jar (many developers learn how to install compressed files. By default, when opening a file, they use to decompress the file and open it. The file can be seen internally, which does not provide the role of simulating data ), in this case, use the Java JAR file running method: javaw command to open the console (win
+ R), Enter cmd and press enter, and enter javaw-jar path (path for your sensorsimulator. jar location), and press enter, then you can see the following interface, that is, open the data simulation window, as shown in:
In the figure, you can see the possible IP addresses option. Enter the IP address (192.168.4.165 in the figure) inProgramIn sensorsimulatorsettings, the default icon is:. after entering the information, click "testing" on the right side of the tab and select connect. Then, the sensorsimulator project is running, you can control the data on the right side of the Data Simulation by moving the slider. The connected graphs are as follows:
for more information about the meaning of each data on the Data Control End, see Article , if you have any questions, welcome to the letter: zhangganhan@126.com.