bridgefy-react-native 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +137 -76
- package/android/build.gradle +37 -56
- package/android/gradle.properties +4 -4
- package/android/src/main/AndroidManifest.xml +1 -11
- package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativeModule.kt +590 -333
- package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativePackage.kt +25 -8
- package/android/src/main/java/me/bridgefy/plugin/react_native/service/BridgefyService.kt +625 -0
- package/android/src/main/java/me/bridgefy/plugin/react_native/util/BridgefyOperationModeManager.kt +193 -0
- package/android/src/main/java/me/bridgefy/plugin/react_native/util/BridgefyServiceManager.kt +123 -0
- package/android/src/main/java/me/bridgefy/plugin/react_native/util/Utils.kt +172 -0
- package/bridgefy-react-native.podspec +5 -25
- package/ios/BridgefyReactNativeModule.m +88 -0
- package/ios/BridgefyReactNativeModule.swift +524 -0
- package/lib/module/NativeBridgefy.js +117 -0
- package/lib/module/NativeBridgefy.js.map +1 -0
- package/lib/module/index.js +172 -207
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeBridgefy.d.ts +250 -0
- package/lib/typescript/src/NativeBridgefy.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +146 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +77 -72
- package/src/NativeBridgefy.ts +321 -0
- package/src/index.tsx +283 -225
- package/ios/BridgefyReactNative.m +0 -56
- package/ios/BridgefyReactNative.swift +0 -368
- package/ios/BridgefyReactNative.xcodeproj/project.pbxproj +0 -293
- package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/xcuserdata/bridgefy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/BridgefyReactNative.xcodeproj/xcuserdata/bridgefy.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/Frameworks/BridgefySDK.xcframework/Info.plist +0 -48
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/BridgefySDK +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +0 -313
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK.h +0 -15
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Info.plist +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.abi.json +0 -7020
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/module.modulemap +0 -11
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/_CodeSignature/CodeResources +0 -190
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +0 -20
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/aarch64/BridgefySDK.yml +0 -13549
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/BridgefySDK +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +0 -622
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK.h +0 -15
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Info.plist +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -7020
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -7020
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -115
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/module.modulemap +0 -11
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/_CodeSignature/CodeResources +0 -245
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +0 -20
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/aarch64/BridgefySDK.yml +0 -13237
- package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/x86_64/BridgefySDK.yml +0 -12858
- package/lib/commonjs/index.js +0 -278
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/infraestructure/index.js +0 -28
- package/lib/commonjs/infraestructure/index.js.map +0 -1
- package/lib/commonjs/infraestructure/interfaces/ibridgefy.js +0 -6
- package/lib/commonjs/infraestructure/interfaces/ibridgefy.js.map +0 -1
- package/lib/commonjs/infraestructure/interfaces/index.js +0 -17
- package/lib/commonjs/infraestructure/interfaces/index.js.map +0 -1
- package/lib/commonjs/infraestructure/services/bridgefy_service.js +0 -6
- package/lib/commonjs/infraestructure/services/bridgefy_service.js.map +0 -1
- package/lib/commonjs/infraestructure/services/index.js +0 -17
- package/lib/commonjs/infraestructure/services/index.js.map +0 -1
- package/lib/module/infraestructure/index.js +0 -3
- package/lib/module/infraestructure/index.js.map +0 -1
- package/lib/module/infraestructure/interfaces/ibridgefy.js +0 -2
- package/lib/module/infraestructure/interfaces/ibridgefy.js.map +0 -1
- package/lib/module/infraestructure/interfaces/index.js +0 -2
- package/lib/module/infraestructure/interfaces/index.js.map +0 -1
- package/lib/module/infraestructure/services/bridgefy_service.js +0 -2
- package/lib/module/infraestructure/services/bridgefy_service.js.map +0 -1
- package/lib/module/infraestructure/services/index.js +0 -2
- package/lib/module/infraestructure/services/index.js.map +0 -1
- package/lib/typescript/index.d.ts +0 -219
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/infraestructure/index.d.ts +0 -3
- package/lib/typescript/infraestructure/index.d.ts.map +0 -1
- package/lib/typescript/infraestructure/interfaces/ibridgefy.d.ts +0 -10
- package/lib/typescript/infraestructure/interfaces/ibridgefy.d.ts.map +0 -1
- package/lib/typescript/infraestructure/interfaces/index.d.ts +0 -2
- package/lib/typescript/infraestructure/interfaces/index.d.ts.map +0 -1
- package/lib/typescript/infraestructure/services/bridgefy_service.d.ts +0 -17
- package/lib/typescript/infraestructure/services/bridgefy_service.d.ts.map +0 -1
- package/lib/typescript/infraestructure/services/index.d.ts +0 -2
- package/lib/typescript/infraestructure/services/index.d.ts.map +0 -1
- package/src/infraestructure/index.tsx +0 -2
- package/src/infraestructure/interfaces/ibridgefy.tsx +0 -10
- package/src/infraestructure/interfaces/index.tsx +0 -1
- package/src/infraestructure/services/bridgefy_service.tsx +0 -20
- package/src/infraestructure/services/index.tsx +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 contact@bridgefy.me
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,55 +1,63 @@
|
|
|
1
|
+
|
|
1
2
|
<p align="center">
|
|
2
|
-
|
|
3
|
+
<img src="https://www.gitbook.com/cdn-cgi/image/width=256,dpr=2,height=40,fit=contain,format=auto/https%3A%2F%2F3290834949-files.gitbook.io%2F~%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5XKIMMP6VF2l9XuPV80l%252Flogo%252Fd78nQFIysoU2bbM5fYNP%252FGroup%25203367.png%3Falt%3Dmedia%26token%3Df83a642d-8a9a-411f-9ef4-d7189a4c5f0a" />
|
|
3
4
|
</p>
|
|
4
5
|
|
|
5
6
|
<p align="center">
|
|
6
|
-
|
|
7
|
+
<img src="https://3290834949-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5XKIMMP6VF2l9XuPV80l%2Fuploads%2FD0HSf0lWC4pWB4U7inIw%2Fharegit.jpg?alt=media&token=a400cf7d-3254-4afc-bed0-48f7d98205b0" />
|
|
7
8
|
</p>
|
|
8
9
|
|
|
9
10
|
# Bridgefy React Native SDK
|
|
11
|
+
|
|
10
12
|

|
|
11
13
|

|
|
12
14
|
|
|
13
|
-
The Bridgefy Software Development Kit (SDK) is a state
|
|
15
|
+
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.
|
|
14
16
|
|
|
15
|
-
Integrate the Bridgefy SDK into your Android and iOS app to reach
|
|
17
|
+
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.
|
|
16
18
|
|
|
17
|
-
**Website
|
|
18
|
-
**Email
|
|
19
|
-
**
|
|
20
|
-
**Facebook
|
|
19
|
+
**Website:** [https://bridgefy.me/sdk](https://bridgefy.me/sdk)
|
|
20
|
+
**Email:** [contact@bridgefy.me](mailto:contact@bridgefy.me)
|
|
21
|
+
**Twitter:** [https://twitter.com/bridgefy](https://twitter.com/bridgefy)
|
|
22
|
+
**Facebook:** [https://www.facebook.com/bridgefy](https://www.facebook.com/bridgefy)
|
|
23
|
+
|
|
24
|
+
---
|
|
21
25
|
|
|
22
26
|
## Operation mode
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
allowing you to join nodes in the same network or nodes in different networks.
|
|
28
|
+
Bridgefy automatically manages device discovery and connections to create a **mesh network**, whose size depends on the number of nearby devices and environmental conditions.
|
|
29
|
+
This mesh allows messages to hop across multiple devices, letting nodes in the same cluster or in different clusters exchange data without Internet access.
|
|
27
30
|
|
|
28
31
|

|
|
29
32
|
|
|
33
|
+
---
|
|
34
|
+
|
|
30
35
|
## Platform permissions
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
individual platform (iOS and Android) first. You can read more about each platform's requirements
|
|
34
|
-
below:
|
|
37
|
+
Before using the SDK in a React Native app, configure the required permissions at the native level for each platform.
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
- [iOS Permissions](https://github.com/bridgefy/sdk-ios#permissions)
|
|
40
|
+
- [Android Permissions](https://github.com/bridgefy/sdk-android#android-permissions)
|
|
41
|
+
|
|
42
|
+
---
|
|
38
43
|
|
|
39
44
|
## Installation
|
|
40
45
|
|
|
46
|
+
Install the SDK via npm or Yarn.
|
|
47
|
+
|
|
41
48
|
```bash
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
|
|
49
|
+
npm i bridgefy-react-native
|
|
50
|
+
# or
|
|
51
|
+
yarn add bridgefy-react-native
|
|
45
52
|
```
|
|
46
53
|
|
|
54
|
+
---
|
|
55
|
+
|
|
47
56
|
## Usage
|
|
48
57
|
|
|
49
58
|
### Initialization
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
We will configure event listeners later.
|
|
60
|
+
Use `initialize` to configure the Bridgefy SDK with your API key and base options.
|
|
53
61
|
|
|
54
62
|
```typescript
|
|
55
63
|
import { Bridgefy, BridgefyPropagationProfile } from 'bridgefy-react-native';
|
|
@@ -57,47 +65,50 @@ import { Bridgefy, BridgefyPropagationProfile } from 'bridgefy-react-native';
|
|
|
57
65
|
const bridgefy = new Bridgefy();
|
|
58
66
|
|
|
59
67
|
export default function App() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
bridgefy
|
|
70
|
+
.initialize({
|
|
71
|
+
apiKey: 'your-api-key-here', // UUID - Your Bridgefy license key.
|
|
72
|
+
verboseLogging: false, // Enables or disables verbose logs.
|
|
73
|
+
operationMode: 'hybrid', // foreground | background | hybrid
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
console.error(error);
|
|
77
|
+
});
|
|
78
|
+
}, []);
|
|
70
79
|
}
|
|
71
80
|
```
|
|
72
81
|
|
|
73
|
-
|
|
82
|
+
### Starting and stopping the SDK
|
|
83
|
+
|
|
84
|
+
Once initialized, you can start or stop the SDK as needed.
|
|
74
85
|
|
|
75
86
|
```typescript
|
|
76
87
|
/**
|
|
77
88
|
* Start Bridgefy SDK operations
|
|
78
89
|
*/
|
|
79
90
|
bridgefy.start(
|
|
80
|
-
userId,
|
|
81
|
-
propagationProfile,
|
|
91
|
+
userId, // Optional UUID - Custom user identifier in the network.
|
|
92
|
+
propagationProfile, // Optional BridgefyPropagationProfile - Message propagation profile.
|
|
82
93
|
);
|
|
83
94
|
|
|
84
95
|
/**
|
|
85
96
|
* Stop Bridgefy SDK operations
|
|
86
97
|
*/
|
|
87
|
-
bridgefy.stop()
|
|
98
|
+
bridgefy.stop();
|
|
88
99
|
```
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Sending data
|
|
91
104
|
|
|
92
|
-
|
|
93
|
-
identify the message that was sent. You'll need to serialize your data into a `string` before
|
|
94
|
-
transmission so React Native can communicate the information to the native platform.
|
|
105
|
+
Use `send` to transmit serialized string data using a transmission mode.
|
|
95
106
|
|
|
96
107
|
```typescript
|
|
97
108
|
async function sendData() {
|
|
98
109
|
const userId = await bridgefy.currentUserId();
|
|
99
110
|
const lastMessageId = await bridgefy.send(
|
|
100
|
-
'data', // String
|
|
111
|
+
'data', // String-encoded data to send.
|
|
101
112
|
{
|
|
102
113
|
type: BridgefyTransmissionModeType.broadcast,
|
|
103
114
|
uuid: userId,
|
|
@@ -106,12 +117,14 @@ async function sendData() {
|
|
|
106
117
|
}
|
|
107
118
|
```
|
|
108
119
|
|
|
109
|
-
|
|
120
|
+
The method returns a message UUID you can use for tracking or acknowledgement flows.
|
|
110
121
|
|
|
111
|
-
|
|
122
|
+
---
|
|
112
123
|
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
## Handling SDK events
|
|
125
|
+
|
|
126
|
+
Bridgefy emits lifecycle and messaging events through React Native's `NativeEventEmitter`.
|
|
127
|
+
Subscribe to events to track startup, incoming messages, errors, and other state changes.
|
|
115
128
|
|
|
116
129
|
```typescript
|
|
117
130
|
React.useEffect(() => {
|
|
@@ -119,67 +132,115 @@ React.useEffect(() => {
|
|
|
119
132
|
const eventEmitter = new NativeEventEmitter(
|
|
120
133
|
NativeModules.BridgefyReactNative
|
|
121
134
|
);
|
|
122
|
-
|
|
135
|
+
|
|
136
|
+
// Fired when the Bridgefy SDK has started successfully.
|
|
123
137
|
subscriptions.push(
|
|
124
138
|
eventEmitter.addListener(BridgefyEvents.bridgefyDidStart, (event) => {
|
|
125
|
-
console.log(
|
|
139
|
+
console.log('Bridgefy started', event);
|
|
126
140
|
})
|
|
127
141
|
);
|
|
128
|
-
|
|
142
|
+
|
|
143
|
+
// Fired when this device receives data from another Bridgefy device.
|
|
129
144
|
subscriptions.push(
|
|
130
145
|
eventEmitter.addListener(
|
|
131
146
|
BridgefyEvents.bridgefyDidReceiveData,
|
|
132
147
|
(event) => {
|
|
133
|
-
console.log(
|
|
148
|
+
console.log('Bridgefy received data', event);
|
|
134
149
|
}
|
|
135
150
|
)
|
|
136
151
|
);
|
|
152
|
+
|
|
137
153
|
return () => {
|
|
138
154
|
for (const sub of subscriptions) {
|
|
139
155
|
sub.remove();
|
|
140
156
|
}
|
|
141
157
|
};
|
|
142
|
-
});
|
|
158
|
+
}, []);
|
|
143
159
|
```
|
|
144
160
|
|
|
145
|
-
|
|
161
|
+
For a complete list of available events, see the `BridgefyEvents` enum in the SDK API reference.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Additional functionality
|
|
166
|
+
|
|
167
|
+
The `Bridgefy` class exposes several helper methods to manage sessions, connectivity, and licensing.
|
|
168
|
+
|
|
169
|
+
- `destroySession()`: Destroys the current SDK session and cleans local state.
|
|
170
|
+
- `establishSecureConnection(userId: string): Promise<void>`: Establishes an end-to-end encrypted connection with the specified peer.
|
|
171
|
+
- `currentUserId(): Promise<string>`: Returns the current device's user identifier.
|
|
172
|
+
- `connectedPeers(): Promise<string[]>`: Returns the list of currently connected peers.
|
|
173
|
+
- `licenseExpirationDate(): Promise<Date>`: Returns the configured license expiration date.
|
|
174
|
+
- `updateLicense(): Promise<void>`: Refreshes the SDK license (for renewed or upgraded plans).
|
|
175
|
+
- `isInitialized(): Promise<boolean>`: Indicates whether the SDK has been initialized.
|
|
176
|
+
- `isStarted(): Promise<boolean>`: Indicates whether the SDK is currently running.
|
|
177
|
+
|
|
178
|
+
### Operation mode control
|
|
179
|
+
|
|
180
|
+
These methods let you inspect and change how Bridgefy runs at runtime.
|
|
181
|
+
|
|
182
|
+
- `setOperationMode(config: BridgefyOperationModeConfig): Promise<BridgefyOperationModeConfig>`
|
|
183
|
+
- `getOperationMode(): Promise<BridgefyOperationModeConfig>`
|
|
184
|
+
- `switchToBackground(): Promise<void>`
|
|
185
|
+
- `switchToForeground(): Promise<void>`
|
|
186
|
+
- `getOperationStatus(): Promise<BridgefyOperationModeStatus>`
|
|
187
|
+
|
|
188
|
+
Always handle promises and error cases to keep your networking layer **robust** and responsive.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Bridgefy propagation profiles
|
|
193
|
+
|
|
194
|
+
The `BridgefyPropagationProfile` enum defines presets for how messages propagate through the mesh, so you can tune behavior to your use case.
|
|
195
|
+
|
|
196
|
+
- `STANDARD`: Balanced default profile for general messaging.
|
|
197
|
+
- `HIGH_DENSITY_NETWORK`: Optimized for crowded environments such as concerts or stadiums.
|
|
198
|
+
- `SPARSE_NETWORK`: Suitable for rural or low-density areas.
|
|
199
|
+
- `LONG_REACH`: Prioritizes maximum distance, useful for emergencies or outdoor activities.
|
|
200
|
+
- `SHORT_REACH`: Focuses on nearby devices only.
|
|
201
|
+
- `REALTIME`: Prioritizes ultra-low latency for time-sensitive notifications.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Background/foreground operation modes guide
|
|
146
206
|
|
|
147
|
-
|
|
148
|
-
The `Bridgefy` class also provides various functionalities:
|
|
207
|
+
Bridgefy supports three main operation modes with different trade-offs in availability and battery usage.
|
|
149
208
|
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
- `licenseExpirationDate(): Promise<Date>`: Get the license expiration date.
|
|
156
|
-
- `isInitialized(): Promise<boolean>`: Check if the SDK is initialized.
|
|
157
|
-
- `isStarted(): Promise<boolean>`: Check if the SDK is started.
|
|
209
|
+
1. **FOREGROUND mode**
|
|
210
|
+
- SDK runs only while the app is in the foreground.
|
|
211
|
+
- No persistent background service.
|
|
212
|
+
- Lower battery usage and simpler integration.
|
|
213
|
+
- Good for development, demos, or foreground-only use cases.
|
|
158
214
|
|
|
159
|
-
|
|
215
|
+
2. **BACKGROUND mode** (Android)
|
|
216
|
+
- SDK runs continuously in a foreground service, even when the app is backgrounded.
|
|
217
|
+
- Enables always-on mesh networking and better reachability.
|
|
218
|
+
- Higher battery consumption; best for critical connectivity scenarios.
|
|
160
219
|
|
|
161
|
-
|
|
220
|
+
3. **HYBRID mode (recommended)**
|
|
221
|
+
- Runs in the foreground while the app is active.
|
|
222
|
+
- Automatically switches to background mode when the app is backgrounded.
|
|
223
|
+
- Automatically resumes foreground mode when the app becomes active again.
|
|
224
|
+
- Smart balance between connectivity and battery for the best user experience.
|
|
162
225
|
|
|
163
|
-
|
|
226
|
+
---
|
|
164
227
|
|
|
165
|
-
-
|
|
166
|
-
- `highDensityNetwork`: High-density network profile.
|
|
167
|
-
- `sparseNetwork`: Sparse network profile.
|
|
168
|
-
- `longReach`: Long-reach profile.
|
|
169
|
-
- `shortReach`: Short-reach profile.
|
|
228
|
+
## Multi-platform support
|
|
170
229
|
|
|
171
|
-
|
|
230
|
+
Bridgefy SDKs interoperate across platforms so iOS and Android devices can communicate seamlessly as long as they run a Bridgefy-enabled app.
|
|
172
231
|
|
|
232
|
+
- [Bridgefy iOS](https://github.com/bridgefy/sdk-ios)
|
|
233
|
+
- [Bridgefy Android](https://github.com/bridgefy/sdk-android)
|
|
173
234
|
|
|
235
|
+
---
|
|
174
236
|
|
|
175
|
-
##
|
|
237
|
+
## Contact & support
|
|
176
238
|
|
|
177
|
-
|
|
239
|
+
For commercial inquiries, technical questions, or integration help, reach out using the channels below.
|
|
178
240
|
|
|
179
|
-
|
|
180
|
-
|
|
241
|
+
- Email: [contact@bridgefy.me](mailto:contact@bridgefy.me)
|
|
242
|
+
- Website: [https://bridgefy.me/sdk](https://bridgefy.me/sdk)
|
|
181
243
|
|
|
182
|
-
|
|
183
|
-
+ contact@bridgefy.me
|
|
244
|
+
---
|
|
184
245
|
|
|
185
|
-
©
|
|
246
|
+
© 2026 Bridgefy Inc. All rights reserved.
|
package/android/build.gradle
CHANGED
|
@@ -1,74 +1,52 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['BridgefyReactNative_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
6
|
+
rootProject.allprojects {
|
|
7
|
+
repositories {
|
|
8
|
+
maven {
|
|
9
|
+
url "http://34.82.5.94:8081/artifactory/libs-release-local"
|
|
10
|
+
allowInsecureProtocol = true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
5
14
|
repositories {
|
|
6
15
|
google()
|
|
7
16
|
mavenCentral()
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:8.
|
|
20
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
12
21
|
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
22
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
23
|
}
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
rootProject.allprojects {
|
|
18
|
-
repositories {
|
|
19
|
-
maven {
|
|
20
|
-
url "http://34.82.5.94:8081/artifactory/libs-release-local"
|
|
21
|
-
allowInsecureProtocol = true
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
allprojects {
|
|
27
|
-
repositories {
|
|
28
|
-
google()
|
|
29
|
-
mavenCentral()
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
def isNewArchitectureEnabled() {
|
|
34
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
35
|
-
}
|
|
36
26
|
|
|
37
27
|
apply plugin: "com.android.library"
|
|
38
28
|
apply plugin: "kotlin-android"
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
42
|
-
|
|
43
|
-
if (isNewArchitectureEnabled()) {
|
|
44
|
-
apply plugin: "com.facebook.react"
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
def getExtOrDefault(name) {
|
|
48
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["BridgefyReactNative_" + name]
|
|
49
|
-
}
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
50
31
|
|
|
51
32
|
def getExtOrIntegerDefault(name) {
|
|
52
33
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["BridgefyReactNative_" + name]).toInteger()
|
|
53
34
|
}
|
|
54
35
|
|
|
55
36
|
android {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
compileOptions {
|
|
59
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
60
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
61
|
-
}
|
|
37
|
+
namespace "me.bridgefy.plugin.react_native"
|
|
62
38
|
|
|
63
|
-
|
|
64
|
-
jvmTarget = '17'
|
|
65
|
-
}
|
|
39
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
66
40
|
|
|
67
41
|
defaultConfig {
|
|
68
42
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
69
43
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
70
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
71
44
|
}
|
|
45
|
+
|
|
46
|
+
buildFeatures {
|
|
47
|
+
buildConfig true
|
|
48
|
+
}
|
|
49
|
+
|
|
72
50
|
buildTypes {
|
|
73
51
|
release {
|
|
74
52
|
minifyEnabled false
|
|
@@ -78,6 +56,20 @@ android {
|
|
|
78
56
|
lintOptions {
|
|
79
57
|
disable "GradleCompatible"
|
|
80
58
|
}
|
|
59
|
+
|
|
60
|
+
compileOptions {
|
|
61
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
62
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
sourceSets {
|
|
66
|
+
main {
|
|
67
|
+
java.srcDirs += [
|
|
68
|
+
"generated/java",
|
|
69
|
+
"generated/jni"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
81
73
|
}
|
|
82
74
|
|
|
83
75
|
repositories {
|
|
@@ -88,20 +80,9 @@ repositories {
|
|
|
88
80
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
89
81
|
|
|
90
82
|
dependencies {
|
|
91
|
-
implementation (group: "me.bridgefy", name: "android-sdk", version: "1.2.
|
|
83
|
+
implementation (group: "me.bridgefy", name: "android-sdk", version: "1.2.5", ext: "aar") {
|
|
92
84
|
transitive = true
|
|
93
85
|
}
|
|
94
|
-
|
|
95
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
96
|
-
//noinspection GradleDynamicVersion
|
|
97
|
-
implementation "com.facebook.react:react-native:+"
|
|
86
|
+
implementation "com.facebook.react:react-android"
|
|
98
87
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
99
88
|
}
|
|
100
|
-
|
|
101
|
-
if (isNewArchitectureEnabled()) {
|
|
102
|
-
react {
|
|
103
|
-
jsRootDir = file("../src/")
|
|
104
|
-
libraryName = "BridgefyReactNative"
|
|
105
|
-
codegenJavaPackageName = "me.bridgefy.plugin.react_native"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
BridgefyReactNative_kotlinVersion=2.0.
|
|
2
|
-
BridgefyReactNative_minSdkVersion=
|
|
3
|
-
BridgefyReactNative_targetSdkVersion=
|
|
1
|
+
BridgefyReactNative_kotlinVersion=2.0.21
|
|
2
|
+
BridgefyReactNative_minSdkVersion=24
|
|
3
|
+
BridgefyReactNative_targetSdkVersion=34
|
|
4
4
|
BridgefyReactNative_compileSdkVersion=35
|
|
5
|
-
|
|
5
|
+
BridgefyReactNative_ndkVersion=27.1.12297006
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
3
|
-
package="me.bridgefy.plugin.react_native">
|
|
4
|
-
<uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" tools:node="replace" />
|
|
5
|
-
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="replace" />
|
|
6
|
-
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" android:maxSdkVersion="30" />
|
|
7
|
-
<uses-permission android:name="android.permission.BLUETOOTH" />
|
|
8
|
-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
|
9
|
-
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="replace" />
|
|
10
|
-
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
|
11
|
-
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
12
2
|
</manifest>
|