-
Notifications
You must be signed in to change notification settings - Fork 11
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
SDK-5238 Delayed init android docs #8397
base: develop
Are you sure you want to change the base?
Changes from 8 commits
c32116d
3b35cca
6502af7
26849b7
310f674
3327630
538752b
e4d100e
79d143f
2091c69
ecc9c8f
3261b59
0a69341
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
nav_title: Delayed Initialization | ||
article_title: Delayed Initialization for Android and FireOS | ||
platform: | ||
- Android | ||
- FireOS | ||
page_order: 10 | ||
description: "This article covers how to implement delayed initialization on the Android SDK and optionally preserve push notification analytics when delayed initialization is enabled." | ||
|
||
--- | ||
|
||
# Delayed initialization for the Braze Android SDK | ||
|
||
> Learn how to enable delayed initialization and opt in to preserve push notification analytics when it is enabled. This can be useful when you need to set up other services before initializing the SDK, such as fetching configuration data from a server or waiting for user consent. | ||
|
||
While delayed initialization is enabled, all network connections will be canceled, and the Braze SDK will not pass any data to Braze servers. | ||
|
||
{% alert important %} | ||
Delayed initialization is available starting in Android SDK version xxxx. | ||
{% endalert %} | ||
|
||
## Enabling Delayed Initialization | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are your thoughts on adding numbers to the subtitles? For example, Step 1: Enabling Delayed Initialization or 1. Enabling Delayed Initialization I think this would help the reader understand that the steps flow together. This is also helpful for parity, because the Swift Docs uses numbered Steps) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not really steps where they all need to be done. Each section is a different part of the feature. If there's numbers, I think users will think they need to do all the steps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right that's true! Since there are cases where a user may never init afterwards, etc. I agree with having no numbers then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow-up: are certain steps required before completing other steps? i.e., maybe doing something like this:
(or something similar?) |
||
|
||
Delayed initialization is disabled by default. In order to delay initialization, update your `braze.xml` file to include `com_braze_enable_delayed_initialization` and confirm its value is set to `true`: | ||
|
||
```xml | ||
<bool name="com_braze_enable_delayed_initialization">true</bool> | ||
``` | ||
|
||
This can additionally be done at runtime via: | ||
internetisaiah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{% tabs %} | ||
{% tab JAVA %} | ||
|
||
```java | ||
Braze.enableDelayedInitialization(context); | ||
``` | ||
|
||
{% endtab %} | ||
{% tab KOTLIN %} | ||
|
||
```kotlin | ||
Braze.enableDelayedInitialization(context) | ||
``` | ||
|
||
{% endtab %} | ||
{% endtabs %} | ||
|
||
## Setting Delayed Initialization Push Analytics Behavior | ||
internetisaiah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
When delayed initialization is enabled, you have the option to queue or drop push analytics. If push analytics are queued, these events will be logged once delayed initialization is disabled. | ||
|
||
By default, push analytics are queued when delayed initialization is enabled. In order to drop push analytics, update your `braze.xml` file to include `com_braze_delayed_initialization_analytics_behavior` as follows: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me, this line:
seems to conflict with the line above it:
could i get some clarity here when you get the chance @chshapiro ? thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. *Note: this has been removed it in the current commit. Please be sure to double-check my changes to ensure I'm still representing the original idea properly 👍🏽 |
||
|
||
```xml | ||
<string name="com_braze_delayed_initialization_analytics_behavior">DROP</string> | ||
``` | ||
|
||
To explicitly queue push analytics, update your `braze.xml` file to include `com_braze_delayed_initialization_analytics_behavior` as follows: | ||
|
||
```xml | ||
<string name="com_braze_delayed_initialization_analytics_behavior">QUEUE</string> | ||
``` | ||
|
||
Additionaly, the push analytics behavior can be set during runtime in the [`Braze.enableDelayedInitialization()`](set link after release) method by using one of the following code snippets: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commenting to remember to add link after release |
||
|
||
{% tabs %} | ||
{% tab JAVA %} | ||
|
||
```java | ||
// Drop all push analytics | ||
Braze.enableDelayedInitialization(context, DelayedInitializationAnalyticsBehavior.DROP); | ||
|
||
// Queue push analytics | ||
Braze.enableDelayedInitialization(context, DelayedInitializationAnalyticsBehavior.QUEUE); | ||
``` | ||
|
||
{% endtab %} | ||
{% tab KOTLIN %} | ||
|
||
```kotlin | ||
// Drop all push analytics | ||
Braze.enableDelayedInitialization(context, DelayedInitializationAnalyticsBehavior.DROP) | ||
|
||
// Queue push analytics | ||
Braze.enableDelayedInitialization(context, DelayedInitializationAnalyticsBehavior.QUEUE) | ||
``` | ||
|
||
{% endtab %} | ||
{% endtabs %} | ||
|
||
## Initializing After Delay | ||
|
||
To initialize the SDK once the delay period is over, use the [`Braze.disableDelayedInitialization()`](set link after release) method: | ||
|
||
{% tabs %} | ||
internetisaiah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{% tab JAVA %} | ||
|
||
```java | ||
Braze.disableDelayedInitialization(context); | ||
``` | ||
|
||
{% endtab %} | ||
{% tab KOTLIN %} | ||
|
||
```kotlin | ||
Braze.disableDelayedInitialization(context) | ||
``` | ||
|
||
{% endtab %} | ||
{% endtabs %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just going to comment here to make sure we don't forget to add the Android version once we have it.