IntroductionInstant Heart Rate Bridge allows your application to communicate with the Instant Heart Rate application, receiving the measured heart rate. Installation- Create a new folder called 'libs' in your project's root folder
- Copy AzumioInstantHeartRateBridge_V1.jar to the newly created folder
- Attach the JAR file to the project
- In Eclipse: Project -> Properties -> Java Build Path -> Add JARs...
Using the BridgeModifying the Manifest fileApplications does not directly access the internet but it does check if the connection is available and a minor AndroidManifest.xml file modification is required. You need to add the following code to the root node of your Manifest file:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Launching the Instant Heart Rate application// launch the Instant Heart Rate application int error = bridge.launch(Main.this); Several error codes might be returned if an error occurs: Bridge.ErrorCodes.APPLICATION_NOT_INSTALLED indicating that the application is not installed or
Bridge.ErrorCodes.APPLICATION_NOT_UPDATED if the user has an older, unsupported application installed
Bridge.ErrorCodes. NO_INTERNET_ACCESS if there is no internet access
If everything is OK Bridge.ErrorCodes.OK is returned.
In both cases Bridge will inform the user that he needs to install and upgrade the application and redirect him to a web page containing information about Instant Heart Rate application and an install link. Receiving the resultAfter the Instant Heart Rate application has finished measuring user's heart rate it closes and returns the data. Your application receives the heart rate as a Intent extra in the onActivityResult() method
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // extracts the heart rate from the result int heartRate = bridge.extractRate(requestCode, resultCode, data); // check if an error code was returned if(heartRate != Bridge.ErrorCodes.RESULT_NOT_AVALILABLE) { // do something with the result } } Demo applicationPlease, download and review the demo application attached to this document. Do not forget to attach the JAR file to the project!
Additional informationPlease, do not hesitate to send us an email to info@azumio.com in case of any additional questions and we will do our best to assist. |