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.
Files changed (105) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +137 -76
  3. package/android/build.gradle +37 -56
  4. package/android/gradle.properties +4 -4
  5. package/android/src/main/AndroidManifest.xml +1 -11
  6. package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativeModule.kt +590 -333
  7. package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativePackage.kt +25 -8
  8. package/android/src/main/java/me/bridgefy/plugin/react_native/service/BridgefyService.kt +625 -0
  9. package/android/src/main/java/me/bridgefy/plugin/react_native/util/BridgefyOperationModeManager.kt +193 -0
  10. package/android/src/main/java/me/bridgefy/plugin/react_native/util/BridgefyServiceManager.kt +123 -0
  11. package/android/src/main/java/me/bridgefy/plugin/react_native/util/Utils.kt +172 -0
  12. package/bridgefy-react-native.podspec +5 -25
  13. package/ios/BridgefyReactNativeModule.m +88 -0
  14. package/ios/BridgefyReactNativeModule.swift +524 -0
  15. package/lib/module/NativeBridgefy.js +117 -0
  16. package/lib/module/NativeBridgefy.js.map +1 -0
  17. package/lib/module/index.js +172 -207
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/module/package.json +1 -0
  20. package/lib/typescript/package.json +1 -0
  21. package/lib/typescript/src/NativeBridgefy.d.ts +250 -0
  22. package/lib/typescript/src/NativeBridgefy.d.ts.map +1 -0
  23. package/lib/typescript/src/index.d.ts +146 -0
  24. package/lib/typescript/src/index.d.ts.map +1 -0
  25. package/package.json +77 -72
  26. package/src/NativeBridgefy.ts +321 -0
  27. package/src/index.tsx +283 -225
  28. package/ios/BridgefyReactNative.m +0 -56
  29. package/ios/BridgefyReactNative.swift +0 -368
  30. package/ios/BridgefyReactNative.xcodeproj/project.pbxproj +0 -293
  31. package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  32. package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  33. package/ios/BridgefyReactNative.xcodeproj/project.xcworkspace/xcuserdata/bridgefy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  34. package/ios/BridgefyReactNative.xcodeproj/xcuserdata/bridgefy.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  35. package/ios/Frameworks/BridgefySDK.xcframework/Info.plist +0 -48
  36. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/BridgefySDK +0 -0
  37. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +0 -313
  38. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK.h +0 -15
  39. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Info.plist +0 -0
  40. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.abi.json +0 -7020
  41. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -115
  42. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  43. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftinterface +0 -115
  44. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/module.modulemap +0 -11
  45. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/_CodeSignature/CodeResources +0 -190
  46. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +0 -20
  47. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
  48. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/aarch64/BridgefySDK.yml +0 -13549
  49. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/BridgefySDK +0 -0
  50. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +0 -622
  51. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK.h +0 -15
  52. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Info.plist +0 -0
  53. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -7020
  54. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -115
  55. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  56. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -115
  57. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -7020
  58. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -115
  59. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  60. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -115
  61. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/module.modulemap +0 -11
  62. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/_CodeSignature/CodeResources +0 -245
  63. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +0 -20
  64. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
  65. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/aarch64/BridgefySDK.yml +0 -13237
  66. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/Relocations/x86_64/BridgefySDK.yml +0 -12858
  67. package/lib/commonjs/index.js +0 -278
  68. package/lib/commonjs/index.js.map +0 -1
  69. package/lib/commonjs/infraestructure/index.js +0 -28
  70. package/lib/commonjs/infraestructure/index.js.map +0 -1
  71. package/lib/commonjs/infraestructure/interfaces/ibridgefy.js +0 -6
  72. package/lib/commonjs/infraestructure/interfaces/ibridgefy.js.map +0 -1
  73. package/lib/commonjs/infraestructure/interfaces/index.js +0 -17
  74. package/lib/commonjs/infraestructure/interfaces/index.js.map +0 -1
  75. package/lib/commonjs/infraestructure/services/bridgefy_service.js +0 -6
  76. package/lib/commonjs/infraestructure/services/bridgefy_service.js.map +0 -1
  77. package/lib/commonjs/infraestructure/services/index.js +0 -17
  78. package/lib/commonjs/infraestructure/services/index.js.map +0 -1
  79. package/lib/module/infraestructure/index.js +0 -3
  80. package/lib/module/infraestructure/index.js.map +0 -1
  81. package/lib/module/infraestructure/interfaces/ibridgefy.js +0 -2
  82. package/lib/module/infraestructure/interfaces/ibridgefy.js.map +0 -1
  83. package/lib/module/infraestructure/interfaces/index.js +0 -2
  84. package/lib/module/infraestructure/interfaces/index.js.map +0 -1
  85. package/lib/module/infraestructure/services/bridgefy_service.js +0 -2
  86. package/lib/module/infraestructure/services/bridgefy_service.js.map +0 -1
  87. package/lib/module/infraestructure/services/index.js +0 -2
  88. package/lib/module/infraestructure/services/index.js.map +0 -1
  89. package/lib/typescript/index.d.ts +0 -219
  90. package/lib/typescript/index.d.ts.map +0 -1
  91. package/lib/typescript/infraestructure/index.d.ts +0 -3
  92. package/lib/typescript/infraestructure/index.d.ts.map +0 -1
  93. package/lib/typescript/infraestructure/interfaces/ibridgefy.d.ts +0 -10
  94. package/lib/typescript/infraestructure/interfaces/ibridgefy.d.ts.map +0 -1
  95. package/lib/typescript/infraestructure/interfaces/index.d.ts +0 -2
  96. package/lib/typescript/infraestructure/interfaces/index.d.ts.map +0 -1
  97. package/lib/typescript/infraestructure/services/bridgefy_service.d.ts +0 -17
  98. package/lib/typescript/infraestructure/services/bridgefy_service.d.ts.map +0 -1
  99. package/lib/typescript/infraestructure/services/index.d.ts +0 -2
  100. package/lib/typescript/infraestructure/services/index.d.ts.map +0 -1
  101. package/src/infraestructure/index.tsx +0 -2
  102. package/src/infraestructure/interfaces/ibridgefy.tsx +0 -10
  103. package/src/infraestructure/interfaces/index.tsx +0 -1
  104. package/src/infraestructure/services/bridgefy_service.tsx +0 -20
  105. package/src/infraestructure/services/index.tsx +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Bridgefy Inc
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
- <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
+ <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
- <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
+ <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
  ![GitHub last commit](https://img.shields.io/github/last-commit/bridgefy/bridgefy-react-native)
11
13
  ![GitHub issues](https://img.shields.io/github/issues-raw/bridgefy/bridgefy-react-native?style=plastic)
12
14
 
13
- 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.
15
+ The **Bridgefy Software Development Kit (SDK)** is a stateoftheart plugandplay 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 the 3.5 billion people that dont always have access to an Internet connection, and watch engagement and revenue grow!
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**. https://bridgefy.me/sdk <br>
18
- **Email**. contact@bridgefy.me <br>
19
- **witter**. https://twitter.com/bridgefy <br>
20
- **Facebook**. https://www.facebook.com/bridgefy <br>
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
- All the connections are handled seamlessly by the SDK to create a mesh network. The size of this
25
- network depends on the number of devices connected and the environment as a variable factor,
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
  ![networking](https://images.saymedia-content.com/.image/t_share/MTkzOTUzODU0MDkyNjE3MjIx/particlesjs-examples.gif)
29
32
 
33
+ ---
34
+
30
35
  ## Platform permissions
31
36
 
32
- To utilize this SDK in a React Native application, you'll need to configure permissions for each
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
- * [iOS Permissions](https://github.com/bridgefy/sdk-ios#permissions)
37
- * [Android Permissions](https://github.com/bridgefy/sdk-android#android-permissions)
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
- $ npm i bridgefy-react-native
43
- # --- or ---
44
- $ yarn install bridgefy-react-native
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
- The `initialize` method initializes the Bridgefy SDK with the given API key and propagation profile.
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
- React.useEffect(() => {
61
- bridgefy
62
- .initialize({
63
- apiKey: 'your-api-key-here', // UUID - The license key registered on the Bridgefy developer site.
64
- verboseLogging: false, // The logging priority for SDK operations.
65
- })
66
- .catch((error) => {
67
- console.error(error);
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
- Once initialized, you can call `start` and `stop` Bridgefy SDK operations as follows:
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, // UUID? (optional) - The ID used to identify the user in the Bridgefy network.If null is passed, the SDK will assign an autogenerated ID.
81
- propagationProfile, // PropagationProfile (optional, default: PropagationProfile.Standard) - A profile that defines a series of properties and rules for the propagation of messages.
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
- ### Sending data
101
+ ---
102
+
103
+ ## Sending data
91
104
 
92
- The following method is used to send data using a transmission mode. This method returns a UUID to
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 encoded data to send.
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
- ### Responding to SDK events
120
+ The method returns a message UUID you can use for tracking or acknowledgement flows.
110
121
 
111
- The SDK can report events to your app through an instance of React's `NativeEventEmitter`.
122
+ ---
112
123
 
113
- The following is an example subscription to a couple of events. Each message will contain
114
- information relevant to the event being transmitted.
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
- // When the Bridgefy SDK started successfully.
135
+
136
+ // Fired when the Bridgefy SDK has started successfully.
123
137
  subscriptions.push(
124
138
  eventEmitter.addListener(BridgefyEvents.bridgefyDidStart, (event) => {
125
- console.log(`Bridgefy started`, event);
139
+ console.log('Bridgefy started', event);
126
140
  })
127
141
  );
128
- // When this device received data from another Bridgefy device.
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(`Bridgefy received data`, event);
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
- To see a full list of events, see the `BridgefyEvents` enum.
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
- ## Additional Functionality
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
- - `destroySession()`: Destroy current session.
151
- - `updateLicense()`: Update license.
152
- - `establishSecureConnection(userId: string): Promise<void>`: Establish a secure connection with a specified user.
153
- - `currentUserId(): Promise<string>`: Get the current user ID.
154
- - `connectedPeers(): Promise<string[]>`: Get a list of connected peers.
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
- Make sure to handle promises and error scenarios appropriately when using these methods.
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
- ## Bridgefy Propagation Profiles
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
- The `BridgefyPropagationProfile` enum defines the following propagation profiles available for use:
226
+ ---
164
227
 
165
- - `standard`: Standard propagation profile.
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
- These profiles can be used when configuring the Bridgefy SDK operations within your React Native application.
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
- ## Multi-Platform Support
237
+ ## Contact & support
176
238
 
177
- 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.
239
+ For commercial inquiries, technical questions, or integration help, reach out using the channels below.
178
240
 
179
- * [Bridgefy iOS](https://github.com/bridgefy/sdk-ios)
180
- * [Bridgefy Android](https://github.com/bridgefy/sdk-android)
241
+ - Email: [contact@bridgefy.me](mailto:contact@bridgefy.me)
242
+ - Website: [https://bridgefy.me/sdk](https://bridgefy.me/sdk)
181
243
 
182
- ## Contact & Support
183
- + contact@bridgefy.me
244
+ ---
184
245
 
185
- © 2023 Bridgefy Inc. All rights reserved
246
+ © 2026 Bridgefy Inc. All rights reserved.
@@ -1,74 +1,52 @@
1
1
  buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["BridgefyReactNative_kotlinVersion"]
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.5.2"
20
+ classpath "com.android.tools.build:gradle:8.7.2"
12
21
  // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
57
-
58
- compileOptions {
59
- sourceCompatibility JavaVersion.VERSION_17
60
- targetCompatibility JavaVersion.VERSION_17
61
- }
37
+ namespace "me.bridgefy.plugin.react_native"
62
38
 
63
- kotlinOptions {
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.2", ext: "aar") {
83
+ implementation (group: "me.bridgefy", name: "android-sdk", version: "1.2.5", ext: "aar") {
92
84
  transitive = true
93
85
  }
94
- // For < 0.71, this will be from the local maven repo
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.20
2
- BridgefyReactNative_minSdkVersion=21
3
- BridgefyReactNative_targetSdkVersion=35
1
+ BridgefyReactNative_kotlinVersion=2.0.21
2
+ BridgefyReactNative_minSdkVersion=24
3
+ BridgefyReactNative_targetSdkVersion=34
4
4
  BridgefyReactNative_compileSdkVersion=35
5
- BridgefyReactNative_ndkversion=28.0.12916984
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>