1.7.0 • Published 2 months ago
@ihealth/ihealthlibrary-react-native v1.7.0
iHealthLibrary_ReactNative
Changelog
###BG1
- (iOS)Removed Event_Device_Connected erroneous event immediately after Event_Scan_Device (清泉)
- (iOS)Added volume to max on Event_Scan_Device (BG1 inserted) (github.com/jackkav)
- Removed Examples and Documents from npm published package to cut down bundle size (github.com/jackkav)
Install
npm install @ihealth/ihealthlibrary-react-native
Configure module for Android
1. android/settings.gradle
include ':ihealthlibrary-react-native'
project(':ihealthlibrary-react-native').projectDir = new File(rootProject.projectDir,'../node_modules/@ihealth/ihealthlibrary-react-native/android')
2. android/app/build.gradle
compile project(':ihealthlibrary-react-native')
3. register module (in MainActivity.java)
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new iHealthDeviceManagerPackage()
);
}
4. configuration of location permission(in AndroidManifest.xml)
<!-- Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in Android API 23+ -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Configure module for iOS
1. Open your iOS project, add node_modules/@ihealth/ihealthlibrary-react-native/ios/ReactNativeIOSLibrary.xcodeproj to libraries
2. Under 'Build Phases' -- 'Link Binary With Libraries', add libReactNativeIOSLibrary.a
Import module
import {
iHealthDeviceManagerModule,
BP5Module,
AM4Module
} from '@ihealth/ihealthlibrary-react-native'
Work Flow
1. Use iHealthDeviceManagerModule to scan device, connect device, monitor connection status.
2. Use devieModule (for example AM3SModule) to operate device function.
Demo Api
Discovery:
//Add listener for event
DeviceEventEmitter.addListener(iHealthDeviceManagerModule.Event_Scan_Device, function (e: Event) {
// handle event.
console.log('~~~' + JSON.stringify(e))
});
//Call the api
iHealthDeviceManagerModule.startDiscovery(iHealthDeviceManagerModule.BP5)
Connect:
//Add listener for event
DeviceEventEmitter.addListener(iHealthDeviceManagerModule.Event_Device_Connected, function (e: Event) {
// handle event.
console.log('~~~' + JSON.stringify(e))
});
DeviceEventEmitter.addListener(iHealthDeviceManagerModule.Event_Device_Connect_Failed, function (e: Event) {
// handle event.
console.log('~~~' + JSON.stringify(e))
});
//Call the api
iHealthDeviceManagerModule.connectDevice(mac,type)
Start/Stop Measure:
//Add listener for event
DeviceEventEmitter.addListener(BP5Module.Event_Notify, function (e: Event) {
// handle event.
console.log('~~~' + JSON.stringify(e))
});
//Call the api
BP5Module.startMeasure(mac)
BP5Module.stopMeasure(mac)
Example
1.8.0-beta1
2 months ago
1.7.0
4 months ago
1.6.0
8 months ago
1.5.3
8 months ago
1.5.1
2 years ago
1.5.0
2 years ago
1.4.9-beta1
3 years ago
1.4.9
3 years ago
1.4.8
3 years ago
1.4.8-beta4
3 years ago
1.4.8-beta3
3 years ago
1.4.8-beta2
3 years ago
1.4.8-beta1
3 years ago
1.4.7
3 years ago
1.4.7-beta2
3 years ago
1.4.7-beta1
3 years ago
1.4.6
3 years ago
1.4.6-beta.1
3 years ago
1.4.5
3 years ago
1.4.5-beta.1
3 years ago
1.4.5-beta
3 years ago
1.4.4
3 years ago
1.4.3
4 years ago
1.4.2
4 years ago
1.4.1
4 years ago
1.4.0
4 years ago
1.3.0-beta.4
4 years ago
1.3.0-beta.3
4 years ago
1.3.0-beta.2
4 years ago
1.3.0-beta.1
4 years ago
1.3.0-beta
4 years ago
1.3.0
4 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.9-beta.3
5 years ago
1.1.9-beta.2
5 years ago
1.1.9-beta.1
5 years ago
1.1.9-beta
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
6 years ago
1.1.5
6 years ago
1.1.4-beta1
6 years ago
1.1.4
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago