Skip to content

Other SDK customizations for Android and FireOS

This reference article covers additional customization and configuration options such as verbose logging, suppressing logging, and how to implement multiple API keys.

Using R8/ProGuard with Braze

Code shrinking configuration is automatically included with your Braze integration.

Client apps that obfuscate Braze code must store release mapping files for Braze to interpret stack traces. If you want to continue to keep all Braze code, add the following to your ProGuard file:

1
2
-keep class bo.app.** { *; }
-keep class com.braze.** { *; }

Enabling verbose logging

Verbose logs from the Braze SDK are essential to a fast turnaround on support issues. These logs should not be modified for clarity; long log files are preferred. Verbose logging is only intended for development environments and should not be enabled in a released application. Verbose logging won’t send any extra or new user information to Braze.

Logs sent to our support team should begin as soon as the application is launched and end well after the observed issue occurs.

To enable verbose logging on the Braze Android SDK:

1
BrazeLogger.setLogLevel(Log.VERBOSE);
1
BrazeLogger.logLevel = Log.VERBOSE

To enable verbose logging in the braze.xml:

1
<integer name="com_braze_logger_initial_log_level">2</integer>

Note that Braze log level integer constants correspond to Android log level integer constants as defined in android.util.log.

To know if your obtained logs are verbose, look for V/Braze somewhere in your logs. For example:

2077-11-19 16:22:49.591 ? V/Braze v9.0.01 .bo.app.d3: Request started

Suppressing Braze SDK logging

The default log level for the Braze Android SDK is INFO.

To change the Braze log level, call BrazeLogger.setLogLevel() with one of the android.util.Log constants or BrazeLogger.SUPPRESS. For example:

1
2
// Suppress all logs
BrazeLogger.setLogLevel(BrazeLogger.SUPPRESS);
1
2
// Suppress all logs
BrazeLogger.setLogLevel(BrazeLogger.SUPPRESS)

Multiple API keys

The most common use case for multiple API keys is separating API keys for debug and release build variants.

To easily switch between multiple API keys in your builds, we recommend creating a separate braze.xml file for each relevant build variant. A build variant is a combination of build type and product flavor. Note that by default, a new Android project is configured with debug and release build types and no product flavors.

For each relevant build variant, create a new braze.xml for it in src/<build variant name>/res/values/:

1
2
3
4
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="com_braze_api_key">REPLACE_WITH_YOUR_BUILD_VARIANT_API_KEY</string>
</resources>

When the build variant is compiled, it will use the new API key.

See the runtime configuration documentation for setting an API key in code.

HOW HELPFUL WAS THIS PAGE?
New Stuff!