Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ This SDK supports [rich push notifications](https://customer.io/docs/sdk/react-n

---

## 🔴 Live Activities

Enable the activity types you use under the `liveNotifications` key of your SDK config. On iOS, also add the `liveactivities` pod subspec and a Widget Extension that renders the SDK's built-in templates.

**One manual step is required on iOS.** Forward every opened URL to the SDK from your `AppDelegate`, or taps on a Live Activity are not attributed. `NativeLiveActivities` comes from the wrapper pod, so import it — and note this only compiles once the `liveactivities` subspec is installed:

```swift
import customerio_reactnative

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// Reports an `opened` metric and returns the deep link to route to. A non-Customer.io URL comes
// back unchanged; `nil` means the activity carried no deep link, so there is nothing to open.
guard let routableUrl = NativeLiveActivities.handleWidgetUrl(url) else { return true }
return super.application(app, open: routableUrl, options: options)
}
```

Android needs no equivalent step. Expo apps need none either — the [config plugin](https://github.com/customerio/customerio-expo-plugin) injects this for you.

---

## Identify Users, Track Events, and More

Customer.io helps you personalize your mobile experience:
Expand Down
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ repositories {
mavenCentral()
google()

// TEMPORARY (REL-1): remove once Live Notifications ships in a released Android SDK.
// Live Notifications are only available from the unreleased branch snapshot.
maven { url 'https://central.sonatype.com/repository/maven-snapshots/' }

def found = false
def defaultDir = null
def androidSourcesName = 'React Native sources'
Expand Down
4 changes: 3 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ customerio.reactnative.kotlinVersion=2.1.20
customerio.reactnative.compileSdkVersion=36
customerio.reactnative.targetSdkVersion=36
customerio.reactnative.minSdkVersion=21
customerio.reactnative.cioSDKVersionAndroid=4.18.2
# TEMPORARY (REL-1): pinned to the unreleased Live Notifications branch snapshot.
# Restore a released version once Live Notifications ships.
customerio.reactnative.cioSDKVersionAndroid=feature-live-notifications-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import com.facebook.react.uimanager.ViewManager
import io.customer.reactnative.sdk.liveactivities.NativeLiveActivitiesModule
import io.customer.reactnative.sdk.location.NativeLocationModule
import io.customer.reactnative.sdk.logging.NativeCustomerIOLoggingModule
import io.customer.reactnative.sdk.messaginginapp.InlineInAppMessageViewManager
Expand Down Expand Up @@ -33,6 +34,13 @@ class CustomerIOReactNativePackage : BaseReactPackage() {
InlineInAppMessageViewManager.NAME -> InlineInAppMessageViewManager()
NativeCustomerIOLoggingModule.NAME -> NativeCustomerIOLoggingModule(reactContext)
NativeCustomerIOModule.NAME -> NativeCustomerIOModule(reactContext = reactContext)
// Unconditional on purpose, unlike Location below. Location has its own artifact
// (io.customer.android:location) that the flag switches between `api` and `compileOnly`,
// so gating it genuinely keeps a dependency off the consumer's classpath. Live
// Notifications ship inside messaging-push-fcm, already a hard dependency here, so a flag
// would remove nothing — and the module is inert until `liveNotifications` config enables
// a type. iOS gates its equivalent only because the subspec pulls in extra pods.
NativeLiveActivitiesModule.NAME -> NativeLiveActivitiesModule(reactContext)
NativeLocationModule.NAME -> if (BuildConfig.CIO_LOCATION_ENABLED) {
NativeLocationModule(reactContext)
} else null
Expand Down Expand Up @@ -71,6 +79,7 @@ class CustomerIOReactNativePackage : BaseReactPackage() {
InlineInAppMessageViewManager.NAME,
NativeCustomerIOLoggingModule.NAME,
NativeCustomerIOModule.NAME,
NativeLiveActivitiesModule.NAME,
NativeLocationModule.NAME,
NativeMessagingInAppModule.NAME,
NativeMessagingPushModule.NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ class NativeCustomerIOModule(
packageConfig.getTypedValue<String>(Keys.Config.CDN_HOST)
?.let { cdnHost(it) }

// Configure push messaging module based on config provided by customer app
// Configure push messaging module based on config provided by customer app.
// Live Activities are hosted by the FCM push module, so the `liveNotifications`
// config is applied to the same module.
packageConfig.getTypedValue<Map<String, Any>>(key = "push").let { pushConfig ->
NativeMessagingPushModule.addNativeModuleFromConfig(
builder = this,
config = pushConfig ?: emptyMap()
config = pushConfig ?: emptyMap(),
liveNotificationsConfig = packageConfig.getTypedValue<Map<String, Any>>(key = "liveNotifications")
)
}
// Configure in-app messaging module based on config provided by customer app
Expand Down
Loading
Loading