bubbl-sdk-rn
v0.1.1
Published
React Native bridge for Bubbl iOS and Android SDKs
Readme
Bubbl React Native SDK
React Native bridge for Bubbl iOS and Android SDKs. Supports legacy NativeModules and TurboModule (RN 0.83+).
Install
npm install bubbl-sdk-rniOS
This library depends on the published iOS pod Bubbl-Sdk.
- Add the Bubbl pod source (if private) to your
ios/Podfile:
source 'https://github.com/CocoaPods/Specs.git'
# source 'https://<your-private-spec-repo>'- Install pods:
cd ios && pod install- Ensure Firebase is set up in your app (per your docs):
pod 'Firebase/Core'- Add
GoogleService-Info.plistto your Xcode project and initialize Firebase inAppDelegate:
import FirebaseCore
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
}Android
- Add the Bubbl Maven repo and credentials (do not hardcode tokens in source control):
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.pkg.github.com/bubbl-tech-sdk/android-sdk"
credentials {
username = project.findProperty('GITHUB_USERNAME') ?: System.getenv('GITHUB_USERNAME')
password = project.findProperty('GITHUB_TOKEN') ?: System.getenv('GITHUB_TOKEN')
}
}
}
}- Add required Android dependencies to your app
build.gradle:
dependencies {
implementation(platform("com.google.firebase:firebase-bom:33.3.0"))
implementation("com.google.firebase:firebase-messaging")
implementation("com.google.android.gms:play-services-location:21.2.0")
implementation("com.google.android.gms:play-services-maps:19.1.0")
implementation("androidx.work:work-runtime-ktx:2.10.0")
}- Add the Google Services plugin:
// project-level build.gradle
classpath("com.google.gms:google-services:4.3.10")
// app-level build.gradle (bottom)
apply plugin: "com.google.gms.google-services"Place your
google-services.jsoninandroid/app/.This module pulls:
tech.bubbl:bubbl-sdk:2.0.9The Android SDK requires Firebase Messaging, Play Services Location, Play Services Maps, and WorkManager in the host app.
Usage
import Bubbl from 'bubbl-sdk-rn';
await Bubbl.start({
apiKey: 'YOUR_KEY',
environment: 'staging',
segmentations: ['default'],
});Example App
cd example
npm install
cd ios && bundle install && bundle exec pod install && cd ..
npm run iosUpdate example/App.tsx with your API key before running.
Events
bubblDidAuthenticate(iOS) =>{ deviceId, bubblId }bubblDidFail(iOS) =>{ message }geofenceSnapshot(Android) => JSON string ofGeofenceSnapshot
Notes
updateAPNsTokenexpects a base64-encoded token string.- Minimum Android SDK is 23 (per requirement).
- RN 0.83 requires iOS 13+, so the podspec is set to iOS 13.
