$ npm i @the-bubbles-company/bubbles-react-native-bridge -S
$ react-native link @the-bubbles-company/bubbles-react-native-bridge
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜@the-bubbles-company/bubbles-react-native-bridge
and addRNBubblesReactBridge.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNBubblesReactBridge.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNBubblesReactBridgePackage;
to the imports at the top of the file - Add
new RNBubblesReactBridgePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-bubbles-react-bridge' project(':react-native-bubbles-react-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bubbles-react-bridge/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-bubbles-react-bridge')
import RNBubblesReactBridge from '@the-bubbles-company/bubbles-react-native-bridge';
// TODO: What to do with the module?
RNBubblesReactBridge;
{
uuid: "F3077ABE93AC465AACF167F080CB7AEF",
minor: "CF2F",
major: "3566",
event: "IN_NEAR_REGION"
}
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
uuid |
String | Beacon UUID in Hexadecimal | ||
minor |
String | Beacon minor in Hexadecimal | ||
major |
String | Beacon major in Hexadecimal | ||
event |
String | Beacon event: ["ENTER", "EXIT", "IN_FAR_REGION", "IN_NEAR_REGION", "IN_IMMEDIATE_REGION"] |
{
identifier: "IBC01SRV000000000099",
name: "Test Service",
description: "Test Service Description",
pictoURL: "http://api-sdk.staging.bubbles-company.com/assets/img/service/assets/IBC01SRV000000000099/base/X4/picto_5943a7bbaa425998002626.png?date=20170110",
pictoSplashURL: "http://api-sdk.staging.bubbles-company.com/assets/img/service/assets/IBC01SRV000000000099/base/X4/picto_splashscreen_5943a7bbc1355691342929.png?date=20170110",
pictoColor: "#45CEDA"
}
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
identifier |
String | Service identifier | ||
name |
String | Service name | ||
description |
String | Service description | ||
pictoURL |
String | Service picto URL | ||
pictoSplashURL |
String | Service splash picto URL | ||
pictoColor |
String | Service picto color |
Displays a log in the application's log system for debug purpose.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
String | Data to add on application log |
No Callbackss
No Event Listener
On Android only
Needs to be called when the React part is up to date (CodePush integration).
No Parameters
No Callbackss
No Event Listener
Gets the application's current Bridge version.
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
version |
String | Application Bridge version |
Reject 1:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
Reject 2:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 2 |
||
message |
String | Error message Version not found |
No Event Listener
Asks for the Services list.
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
services |
Array | Services array | ||
services.row |
Service | Service object |
Reject:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
No Event Listener
Asks the application to update the Services list.
No Parameters
No Callbackss
See
onServicesChange
Asks the application to open a specific Service.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
serviceId |
String | Service identifier |
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
success |
Boolean | Return false when service not found |
Reject 1:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
Reject 2:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 1 |
||
message |
String | Error message Unknown Service |
No Event Listener
Asks the application to close the current Service.
No Parameters
No Callbackss
No Event Listener
Retrieves the Beacons list detected by the phone.
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
beacons |
Array | <optional> |
[] | Beacons array |
beacons.row |
Beacon | Beacons object |
Reject:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
No Event Listener
Gets the phone's Bluetooth state.
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
isActivated |
Boolean | Return Bluetooth state |
Reject:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
No Event Listener
Gets phone's Localization permission state.
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
is_authorized |
Boolean | Return Permission state |
Reject:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
No Event Listener
Asks for phone's Localization permission.
No Parameters
No callbacks
See
onLocalizationPermissionChange
On Android only
Asks for phone's Unique Id permission.
No Parameters
No callbacks
See
onSendUniqueId
Asks application to enable the Bluetooth (without prompting it to the user).
No Parameters
Resolve:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
enabled |
Boolean | Bluetooth has been enabled successfully |
Reject 1:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 0 |
||
message |
String | Error message JSON Exception |
Reject 2:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 3 |
||
message |
String | Error message Impossible to activate Bluetooth |
Reject 3:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
code |
Integer | Error code 4 |
||
message |
String | Error message Bluetooth already activated |
No Event Listener
Triggers when the Services list is updated.
No Parameters
No Callbacks
If succeeded:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
services |
Array | Service list | ||
services.row |
Service | Service object |
If failed:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
success |
Array | false |
||
message |
String | Error message |
Triggers any Beacon data change.
No Parameters
No Callbacks
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
beacon |
Beacon | Beacon new state |
Triggers when the Bluetooth state changes.
No Parameters
No Callbacks
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
isActivated |
Boolean | Bluetooth state |
Triggers after that the permission question is answered by the user.
No Parameters
No Callbacks
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
isAuthorized |
Boolean | Return false if user refuse |
On Android only
Triggers after that the permission question is answered by the user.
No Parameters
No Callbacks
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
isAuthorized |
Boolean | Return false if user refuse |