bridgefy 1.0.4 bridgefy: ^1.0.4 copied to clipboard
The Bridgefy SDK is a state-of-the-art, plug-and-play package that lets people use apps when they don’t have access to the Internet by using mesh networ
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. contact@bridgefy.me
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:
Installation #
To install this SDK, you'll need to either add the following to your pubspec.yaml
file:
dependencies:
bridgefy: ^1.0.4
Or run this flutter command:
flutter pub add bridgefy
Usage #
Initialization #
The init method initializes the Bridgefy SDK with the given API key and propagation profile. The
delegate parameter is required and should be an object that conforms to the BridgefyDelegate
mixin.
The following code shows how to start 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();
_bridgefy.initialize(
apiKey: "<API_KEY>",
propagationProfile: BridgefyPropagationProfile.longReach,
delegate: this
);
}
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,
),
);
}
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` contains the ID of the message.
}
When the app received data through Bridgefy:
@override
void bridgefyDidReceiveData({
required Uint8List data,
required String messageId,
required BridgefyTransmissionMode transmissionMode,
}) {
// `data` contains the message bytes.
}
To see a full list of events, take a look at the BridgefyDelegate
mixin.
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.
Contact & Support #
© 2023 Bridgefy Inc. All rights reserved