bridgefy-react-native
v1.1.9
Published
Bridgefy React Native Library
Readme
Bridgefy React Native SDK
The Bridgefy Software Development Kit (SDK) is a state‑of‑the‑art plug‑and‑play solution that enables offline communication in your mobile apps by using Bluetooth mesh networks.
Integrate the Bridgefy SDK into your Android and iOS app to reach users who don't always have a reliable Internet connection and keep engagement high even in challenging environments.
Website: https://bridgefy.me/sdk Email: [email protected] Twitter: https://twitter.com/bridgefy Facebook: https://www.facebook.com/bridgefy
Operation mode
Bridgefy automatically manages device discovery and connections to create a mesh network, whose size depends on the number of nearby devices and environmental conditions. This mesh allows messages to hop across multiple devices, letting nodes in the same cluster or in different clusters exchange data without Internet access.

Platform permissions
Before using the SDK in a React Native app, configure the required permissions at the native level for each platform.
Installation
Install the SDK via npm or Yarn.
npm i bridgefy-react-native
# or
yarn add bridgefy-react-nativeUsage
Initialization
Use initialize to configure the Bridgefy SDK with your API key and base options.
import { Bridgefy, BridgefyPropagationProfile } from 'bridgefy-react-native';
const bridgefy = new Bridgefy();
export default function App() {
React.useEffect(() => {
bridgefy
.initialize({
apiKey: 'your-api-key-here', // UUID - Your Bridgefy license key.
verboseLogging: false, // Enables or disables verbose logs.
operationMode: 'hybrid', // foreground | background | hybrid
})
.catch((error) => {
console.error(error);
});
}, []);
}Starting and stopping the SDK
Once initialized, you can start or stop the SDK as needed.
/**
* Start Bridgefy SDK operations
*/
bridgefy.start(
userId, // Optional UUID - Custom user identifier in the network.
propagationProfile, // Optional BridgefyPropagationProfile - Message propagation profile.
);
/**
* Stop Bridgefy SDK operations
*/
bridgefy.stop();Sending data
Use send to transmit serialized string data using a transmission mode.
async function sendData() {
const userId = await bridgefy.currentUserId();
const lastMessageId = await bridgefy.send(
'data', // String-encoded data to send.
{
type: BridgefyTransmissionModeType.broadcast,
uuid: userId,
},
);
}The method returns a message UUID you can use for tracking or acknowledgement flows.
Handling SDK events
Bridgefy emits lifecycle and messaging events through React Native's NativeEventEmitter.
Subscribe to events to track startup, incoming messages, errors, and other state changes.
React.useEffect(() => {
const subscriptions: EmitterSubscription[] = [];
const eventEmitter = new NativeEventEmitter(
NativeModules.BridgefyReactNative
);
// Fired when the Bridgefy SDK has started successfully.
subscriptions.push(
eventEmitter.addListener(BridgefyEvents.bridgefyDidStart, (event) => {
console.log('Bridgefy started', event);
})
);
// Fired when this device receives data from another Bridgefy device.
subscriptions.push(
eventEmitter.addListener(
BridgefyEvents.bridgefyDidReceiveData,
(event) => {
console.log('Bridgefy received data', event);
}
)
);
return () => {
for (const sub of subscriptions) {
sub.remove();
}
};
}, []);For a complete list of available events, see the BridgefyEvents enum in the SDK API reference.
Additional functionality
The Bridgefy class exposes several helper methods to manage sessions, connectivity, and licensing.
destroySession(): Destroys the current SDK session and cleans local state.establishSecureConnection(userId: string): Promise<void>: Establishes an end-to-end encrypted connection with the specified peer.currentUserId(): Promise<string>: Returns the current device's user identifier.connectedPeers(): Promise<string[]>: Returns the list of currently connected peers.licenseExpirationDate(): Promise<Date>: Returns the configured license expiration date.updateLicense(): Promise<void>: Refreshes the SDK license (for renewed or upgraded plans).isInitialized(): Promise<boolean>: Indicates whether the SDK has been initialized.isStarted(): Promise<boolean>: Indicates whether the SDK is currently running.
Operation mode control
These methods let you inspect and change how Bridgefy runs at runtime.
setOperationMode(config: BridgefyOperationModeConfig): Promise<BridgefyOperationModeConfig>getOperationMode(): Promise<BridgefyOperationModeConfig>switchToBackground(): Promise<void>switchToForeground(): Promise<void>getOperationStatus(): Promise<BridgefyOperationModeStatus>
Always handle promises and error cases to keep your networking layer robust and responsive.
Bridgefy propagation profiles
The BridgefyPropagationProfile enum defines presets for how messages propagate through the mesh, so you can tune behavior to your use case.
STANDARD: Balanced default profile for general messaging.HIGH_DENSITY_NETWORK: Optimized for crowded environments such as concerts or stadiums.SPARSE_NETWORK: Suitable for rural or low-density areas.LONG_REACH: Prioritizes maximum distance, useful for emergencies or outdoor activities.SHORT_REACH: Focuses on nearby devices only.REALTIME: Prioritizes ultra-low latency for time-sensitive notifications.
Background/foreground operation modes guide
Bridgefy supports three main operation modes with different trade-offs in availability and battery usage.
- FOREGROUND mode
- SDK runs only while the app is in the foreground.
- No persistent background service.
- Lower battery usage and simpler integration.
- Good for development, demos, or foreground-only use cases.
- BACKGROUND mode (Android)
- SDK runs continuously in a foreground service, even when the app is backgrounded.
- Enables always-on mesh networking and better reachability.
- Higher battery consumption; best for critical connectivity scenarios.
- HYBRID mode (recommended)
- Runs in the foreground while the app is active.
- Automatically switches to background mode when the app is backgrounded.
- Automatically resumes foreground mode when the app becomes active again.
- Smart balance between connectivity and battery for the best user experience.
Multi-platform support
Bridgefy SDKs interoperate across platforms so iOS and Android devices can communicate seamlessly as long as they run a Bridgefy-enabled app.
Contact & support
For commercial inquiries, technical questions, or integration help, reach out using the channels below.
- Email: [email protected]
- Website: https://bridgefy.me/sdk
© 2026 Bridgefy Inc. All rights reserved.
