Skip to content

Initial SDK iOS Setup

This reference article covers how to install the Braze iOS SDK for Cordova.

Download the SDK from GitHub and run the following from the root your project:

1
cordova plugin add path_to_repo/braze-cordova-sdk/

Alternatively, if you are running Cordova 6 or later, you could install directly from Github:

1
cordova plugin add https://github.com/braze-inc/braze-cordova-sdk#master

Configure the plugin

In your config.xml, add a preference element under the iOS platform element that contains your Braze API key with the name com.braze.api_key:

1
2
3
<platform name="ios">
    <preference name="com.braze.api_key" value="YOUR_API_KEY" />
</platform>

Set up your applications to have the appropriate certificates for push, via the iOS push documentation.

Removing automatic push setup

If you want to turn off iOS automatic push registration, set the following configuration preferences:

1
2
3
4
<platform name="ios">
    <preference name="com.braze.ios_disable_automatic_push_registration" value="YES" />
    ...
</platform>

Optional IDFA collection

To enable the automatic collection of the iOS IDFA, set the following configuration preferences:

1
2
3
<platform name="ios">
    <preference name="com.braze.ios_enable_idfa_automatic_collection" value="YES" />
</platform>

Location collection and geofences

To enable location collection and Braze Geofences, use the geofence-branch instead of the default master branch. By default, the Braze SDK disables location collection and Braze Geofences. Additionally, use the following preferences configuration:

1
2
3
4
<platform name="ios">
    <preference name="com.braze.enable_location_collection" value="true" />
    <preference name="com.braze.geofences_enabled" value="true" />
</platform>

The geofence-branch can be added to your Cordova project with the following:

1
cordova plugin add https://github.com/braze-inc/braze-cordova-sdk#geofence-branch

See iOS Geofences for more details.

Initial setup complete

Once the initial setup is complete, you can access the BrazePlugin JavaScript interface in your app.

WAS THIS PAGE HELPFUL?
New Stuff!