0 purchases
bridgefy
Bridgefy Flutter SDK #
The Bridgefy Software Development Kit (SDK) is a state-of-the-art, plug-and-play package that will let people use your mobile app when they don’t have access to the Internet, by using Bluetooth mesh networks.
Integrate the Bridgefy SDK into your Android and iOS app to reach the 3.5 billion people that don’t always have access to an Internet connection, and watch engagement and revenue grow!
Website. https://bridgefy.me/sdk
Email. [email protected]
witter. https://twitter.com/bridgefy
Facebook. https://www.facebook.com/bridgefy
Operation mode #
All the connections are handled seamlessly by the SDK to create a mesh network. The size of this
network depends on the number of devices connected and the environment as a variable factor,
allowing you to join nodes in the same network or nodes in different networks.
Platform permissions #
To utilize this SDK in a Flutter application, you'll need to configure permissions for each
individual platform (iOS and Android) first. You can read more about each platform's requirements
below:
iOS Permissions
Android Permissions
Installation #
To install this SDK, you'll need to either add the following to your pubspec.yaml file:
dependencies:
bridgefy: ^1.1.7
copied to clipboard
Or run this flutter command:
flutter pub add bridgefy
copied to clipboard
Usage #
Initialization #
The init method initializes the Bridgefy SDK with the given API key and verbose logging. The
delegate parameter is required and should be an object that conforms to the BridgefyDelegatemixin.
The following code shows how to init the SDK (using your API key) and how to assign the delegate.
import 'package:bridgefy/bridgefy.dart';
class _MyAppState extends State<MyApp> implements BridgefyDelegate {
final _bridgefy = Bridgefy();
@override
void initState() {
super.initState();
try {
await _bridgefy.initialize(
apiKey: "<API_KEY>",
delegate: this,
verboseLogging: true,
);
} catch (e) {
_log("Unable to initialize: $e");
}
}
copied to clipboard
Start Bridgefy #
The following code shows how to start the SDK with propagation profile and custom user Id.
_bridgefy.start(
userId: "Custom UUID",
propagationProfile: BridgefyPropagationProfile.standard
);
copied to clipboard
Stop Bridgefy #
Stop Bridgefy operations
_bridgefy.stop();
copied to clipboard
Sending data #
The following method is used to send data using a transmission mode. This method returns a UUID to
identify the message sent.
void _send() async {
final lastMessageId = await _bridgefy.send(
data: _data, // Uint8List data to send
transmissionMode: BridgefyTransmissionMode(
type: BridgefyTransmissionModeType.broadcast,
uuid: await _bridgefy.currentUserID,
),
);
}
copied to clipboard
Responding to SDK events #
The SDK will report events to your app through the BridgefyDelegate object you specified upon
initialization.
The following is an example event emitted when a message is successfully sent:
@override
void bridgefyDidSendMessage({required String messageID}) {
// `messageID` The id of the message sent successfully.
}
// This function is called when the message could not be sent.
@override
void bridgefyDidFailSendingMessage({required String messageID, BridgefyError? error}) {
// `messageID`: The id of the message that was tried to be sent.
// `error`: Error reason.
}
copied to clipboard
When the app received data through Bridgefy:
@override
void bridgefyDidReceiveData({
required Uint8List data,
required String messageId,
required BridgefyTransmissionMode transmissionMode,
}) {
// `data` contains the message bytes.
}
copied to clipboard
Transmission Mode #
BridgefyTransmissionModeType specifies different transmission modes:
p2p: Deliver a message to a specific recipient only if there's an active connection with it.
mesh: Deliver a message to a specific recipient using nearby devices to propagate it.
broadcast: Propagate a message readable by every device that receives it.
PropagationProfile #
BridgefyPropagationProfile defines different propagation profiles within the BridgefySDK.
standard: Represents a standard propagation profile.
highDensityNetwork: Indicates a propagation profile suitable for high-density networks.
sparseNetwork: Represents a propagation profile tailored for sparse networks.
longReach: Indicates a propagation profile optimized for long reach.
shortReach: Represents a propagation profile designed for short reach communication.
Nearby peer detection #
The following method is invoked when a peer has established connection:
@override
void bridgefyDidConnect({required String userID}) {
// `userID` the peer connected
}
copied to clipboard
When a peer is disconnected(out of range), the following method will be invoked:
@override
void bridgefyDidDisconnect({required String userID}) {
// `userID` the peer disconnected
}
copied to clipboard
To see a full list of events, take a look at the BridgefyDelegate mixin.
Other Utilities #
Retrieve current user ID:
String currentUserID = await _bridgefy.currentUserID;
copied to clipboard
Get a list of connected peers:
List<String> connectedPeers = await _bridgefy.connectedPeers;
copied to clipboard
Check if the SDK is initialized or started:
bool isInitialized = await _bridgefy.isInitialized;
bool isStarted = await _bridgefy.isStarted;
copied to clipboard
Retrieve license expiration date:
DateTime? expirationDate = await _bridgefy.licenseExpirationDate;
copied to clipboard
License Update #
Update the license:
await _bridgefy.updateLicense();
copied to clipboard
Multi-Platform Support #
Bridgefy's SDKs are designed to work seamlessly across different platforms, including iOS and Android. This means that users with different devices can communicate with each other as long as they have the Bridgefy-enabled applications installed.
Bridgefy iOS
Bridgefy Android
Contact & Support #
[email protected]
© 2023 Bridgefy Inc. All rights reserved
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.