React Native SDK Guide
The Impilo Mobile SDK enables faster and unified integration of remote patient monitoring (RPM) devices for mobile applications. Our React Native SDK handles connecting and communicating with RPM devices while providing you with standardized interactions and data.
Installation
Add the SDK to your project and import it:
import { SDK, SDKProvider, useSDKContext, useDeviceDiscovery } from 'react-native-impilo-mobile-sdk';
SDK Initialization
Wrap your app with SDKProvider and initialize the SDK:
import { SDKProvider, useSDKContext, SDK } from 'react-native-impilo-mobile-sdk';
function App() {
return (
<SDKProvider>
<MainApp />
</SDKProvider>
);
}
function MainApp() {
const { sdk, initializeSDK } = useSDKContext();
useEffect(() => {
if (!sdk) {
SDK.initialize();
initializeSDK();
}
}, [sdk]);
return <YourContent />;
}
Discovering Devices
Use the useDeviceDiscovery hook to discover devices. When a device is discovered, the callback will be invoked:
const { discoverTranstekBBZ32BB01 } = useDeviceDiscovery();
discoverTranstekBBZ32BB01((device) => {
console.log('Found device:', device.bluetoothIdentifier());
});
Pairing Devices
A discovered device can be paired with. To pair, call pair on the discovered device:
unpairedDevice.pair((pairedDevice) => {
console.log('Device paired successfully!');
});
To remember a device for later, store its identifier:
const identifier = device.bluetoothIdentifier();
If the device was previously paired, you can skip the pairing process:
const pairedDevice = unpairedDevice.skipPairing();
Getting Readings
Call monitorForReading() to receive readings when they are available:
pairedDevice.monitorForReading((reading) => {
console.log('Reading received:', reading);
});
Complete Example
import { SDKProvider, useSDKContext, useDeviceDiscovery, SDK } from 'react-native-impilo-mobile-sdk';
function App() {
return (
<SDKProvider>
<DeviceScreen />
</SDKProvider>
);
}
function DeviceScreen() {
const { sdk, initializeSDK } = useSDKContext();
const { discoverTranstekBBZ32BB01 } = useDeviceDiscovery();
useEffect(() => {
if (!sdk) {
SDK.initialize();
initializeSDK();
}
}, [sdk]);
const startDiscovery = () => {
discoverTranstekBBZ32BB01((unpairedDevice) => {
unpairedDevice.pair((pairedDevice) => {
pairedDevice.monitorForReading((reading) => {
console.log('Reading:', reading);
});
});
});
};
return <Button title="Discover" onPress={startDiscovery} />;
}
How Data is Managed
The SDK does not store any data—it only forwards received data to you. You are responsible for handling and storing readings as needed in your application.
Working with Apple Health (iOS)
Request access to Apple Health from the user:
import { ReadingType } from 'react-native-impilo-mobile-sdk';
await sdk.appleHealth.requestAccess(
[ReadingType.BloodPressure, ReadingType.BloodGlucose],
[] // write types
);
Query readings from Apple Health:
const readings = await sdk.appleHealth.bloodPressure.query({
startDate: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
endDate: new Date().toISOString(),
limit: 100,
});
Insert readings to Apple Health:
await sdk.appleHealth.bloodPressure.insert({
systolic: 120,
diastolic: 80,
timestamp: new Date().toISOString(),
});
Supported Reading Types
- Blood Pressure
- Blood Glucose
- Blood Oxygen
- Body Weight
- Body Temperature
- Peak Flow
Working with Health Connect (Android)
Request access to Health Connect from the user:
import { ReadingType } from 'react-native-impilo-mobile-sdk';
await sdk.androidHealthConnect.requestAccess(
[ReadingType.BloodPressure, ReadingType.BloodGlucose],
[] // write types
);
Query readings from Health Connect:
const readings = await sdk.androidHealthConnect.bloodPressure.query({
startDate: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
endDate: new Date().toISOString(),
limit: 100,
});
Insert readings to Health Connect:
await sdk.androidHealthConnect.bloodPressure.insert({
systolic: 120,
diastolic: 80,
timestamp: new Date().toISOString(),
});
Supported Reading Types
- Blood Pressure
- Blood Glucose
- Blood Oxygen
- Body Weight
- Body Temperature
- Peak Flow
Looking for More Device Integrations?
For additional device integration requests, please reach out to sales@impilo.health.