Articles‎ > ‎

How to play with Heart Rate sensor from MOTOACTV

The Heart Rate sensor, known as one kind of WSensor (may be Wireless Sensor), communicates with MOTOACTV through ANT+ service. As you may know, the ANT+ service of MOTOACTV is not implemented following any standard. It is a proprietary implementation, stored in /system/framework/framework.jar

To access the proprietary WSensor API, the simplest way is using Java Reflection. But this method has a shortage, that is we cannot create sub-class or implement the interfaces in an easy way.

To overcome this issue, another solution is to create a Java Library (JAR file) to be imported by a Android Project. The Java Library contains only some required WSensor classes and interfaces in framework.jar. The Android project just imported the JAR and doesn't export the JAR in the output APK. Then the used WSensor classes will be lazily linked and loaded by Android Dalvik VM from framework.jar.

In attachments, I attached the a Java Library Project (MotorolaWSensor) and a example Java Class to access the Heart Beat sensor.



Donation:

ċ
ANTServiceActivity.java
(3k)
Thomas Leung,
Oct 30, 2012, 7:00 AM
ċ
Thomas Leung,
Oct 30, 2012, 6:56 AM
ċ
SensorUtil.java
(18k)
Thomas Leung,
Oct 30, 2012, 7:00 AM
Comments