Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expo 47 and react native updates #4675

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,30 @@ Integrating push notifications in React Native requires setting up each native p

Set the `enableBrazeIosPush` and `enableFirebaseCloudMessaging` props to enable push for iOS and Android, respectively.

### iOS setup

#### Generating a New Push Key
KellieHawks marked this conversation as resolved.
Show resolved Hide resolved
If you do not have an existing push key or certificate from Apple or want to generate a new one, follow [Step 1 of the iOS integration instructions]({{site.baseurl}}/developer_guide/platform_integration_guides/ios/push_notifications/integration/#step-1-configure-push-notifications) to generate a new push key and upload it to the Braze dashboard.

#### Migrating a Push Key from expo-notifications
KellieHawks marked this conversation as resolved.
Show resolved Hide resolved
If you were previously using `expo-notifications` to manage your push key, run `expo fetch:ios:certs` from your application's root folder. This will download your push key (a .p8 file), which can then be uploaded to the Braze dashboard.

### Android setup

#### Step 1.1
Set the `firebaseCloudMessagingSenderId` config prop in your `app.json`. See the [Android integration instructions]({{site.baseurl}}/developer_guide/platform_integration_guides/android/push_notifications/android/integration/standard_integration#step-4-set-your-firebase-credentials) on retrieving your sender ID.
Set the `firebaseCloudMessagingSenderId` config prop in your `app.json`. See the [Android integration instructions]({{site.baseurl}}/developer_guide/platform_integration_guides/android/push_notifications/android/integration/standard_integration#step-4-set-your-firebase-credentials) on retrieving your sender ID.

If you'd like the Braze SDK to automatically handle push deep links, set `androidHandlePushDeepLinksAutomatically: true` in your `app.json`.

#### Step 1.2
Add your `google-services.json` file to your application's `assets` folder. This file is required when setting `enableFirebaseCloudMessaging: true` in your configuration.
Add your `google-services.json` filepath to your `app.json`. This file is required when setting `enableFirebaseCloudMessaging: true` in your configuration.

```json
{
"expo": {
"android": {
"googleServicesFile": "PATH_TO_GOOGLE_SERVICES"
},
"plugins": [
[
"@braze/expo-plugin",
Expand All @@ -38,7 +51,8 @@ Add your `google-services.json` file to your application's `assets` folder. This
"iosApiKey": "YOUR-IOS-API-KEY",
"enableBrazeIosPush": true,
"enableFirebaseCloudMessaging": true,
"firebaseCloudMessagingSenderId": "YOUR-FCM-SENDER-ID"
"firebaseCloudMessagingSenderId": "YOUR-FCM-SENDER-ID",
"androidHandlePushDeepLinksAutomatically": true
}
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To complete the installation, you will need the [App Identifier API key]({{site.
## Step 1: Integrate the Braze library

{% alert note %}
Braze React Native SDK v1.38.0+ requires at least React Native v0.64+.
Braze React Native SDK v1.38.0+ requires at least React Native v0.64+. Braze React Native SDK is not yet compatible with the new React Native architecture.
{% endalert %}

{% tabs local %}
Expand Down Expand Up @@ -51,22 +51,23 @@ expo install @braze/expo-plugin

In your `app.json`, add the Braze Expo Plugin. You can provide the following configuration options:

| Method | Type | Description |
| ------------------------------------| ---------| -------------------------------------------------------------------------------------------------------------------------------------------------------|
| `androidApiKey` | string | Required. The API key for your Android application. |
| `iosApiKey` | string | Required. The API key for your iOS application. |
| `baseUrl` | string | Required. The [SDK endpoint]({{site.baseurl}}/api/basics/#endpoints) for your application. |
| `enableBrazeIosPush` | boolean | iOS only. Whether to use Braze to handle push notifications on iOS. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `enableFirebaseCloudMessaging` | boolean | Android only. Whether to use Firebase Cloud Messaging for push notifications. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `firebaseCloudMessagingSenderId` | string | Android only. Your Firebase Cloud Messaging sender ID. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `sessionTimeout` | integer | The Braze session timeout for your application in seconds. |
| `enableSdkAuthentication` | boolean | Whether to enable the [SDK Authentication](https://www.braze.com/docs/developer_guide/platform_wide/sdk_authentication#sdk-authentication) feature. |
| `logLevel` | integer | The log level for your application. The default log level is 8 and will minimally log info. To enable verbose logging for debugging, use log level 0. |
| `minimumTriggerIntervalInSeconds` | integer | The minimum time interval in seconds between triggers. Defaults to 30 seconds. |
| `enableAutomaticLocationCollection` | boolean | Whether automatic location collection is enabled (if the user permits). |
| `enableGeofence` | boolean | Whether geofences are enabled. |
| `enableAutomaticGeofenceRequests` | boolean | Whether geofence requests should be made automatically. |
| `dismissModalOnOutsideTap` | boolean | iOS only. Whether a modal in-app message will be dismissed when the user clicks outside of the in-app message. |
| Method | Type | Description |
| ------------------------------------------| ---------| -------------------------------------------------------------------------------------------------------------------------------------------------------|
| `androidApiKey` | string | Required. The API key for your Android application. |
| `iosApiKey` | string | Required. The API key for your iOS application. |
| `baseUrl` | string | Required. The [SDK endpoint]({{site.baseurl}}/api/basics/#endpoints) for your application. |
| `enableBrazeIosPush` | boolean | iOS only. Whether to use Braze to handle push notifications on iOS. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `enableFirebaseCloudMessaging` | boolean | Android only. Whether to use Firebase Cloud Messaging for push notifications. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `firebaseCloudMessagingSenderId` | string | Android only. Your Firebase Cloud Messaging sender ID. Introduced in React Native SDK v1.38.0 and Expo Plugin v0.4.0. |
| `sessionTimeout` | integer | The Braze session timeout for your application in seconds. |
| `enableSdkAuthentication` | boolean | Whether to enable the [SDK Authentication](https://www.braze.com/docs/developer_guide/platform_wide/sdk_authentication#sdk-authentication) feature. |
| `logLevel` | integer | The log level for your application. The default log level is 8 and will minimally log info. To enable verbose logging for debugging, use log level 0. |
| `minimumTriggerIntervalInSeconds` | integer | The minimum time interval in seconds between triggers. Defaults to 30 seconds. |
| `enableAutomaticLocationCollection` | boolean | Whether automatic location collection is enabled (if the user permits). |
| `enableGeofence` | boolean | Whether geofences are enabled. |
| `enableAutomaticGeofenceRequests` | boolean | Whether geofence requests should be made automatically. |
| `dismissModalOnOutsideTap` | boolean | iOS only. Whether a modal in-app message will be dismissed when the user clicks outside of the in-app message. |
| `androidHandlePushDeepLinksAutomatically` | boolean | Android only. Whether the Braze SDK should automatically handle push deep links. |
{: .reset-td-br-1 .reset-td-br-2 .reset-td-br-3}

Example configuration:
Expand All @@ -86,6 +87,7 @@ Example configuration:
"enableBrazeIosPush": false,
"enableFirebaseCloudMessaging": false,
"firebaseCloudMessagingSenderId": "YOUR-FCM-SENDER-ID",
"androidHandlePushDeepLinksAutomatically": true,
"enableSdkAuthentication": false,
"logLevel": 0,
"minimumTriggerIntervalInSeconds": 0,
Expand Down