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

Appboy -> Braze docs updates #4601

Merged
merged 13 commits into from
Jan 5, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Then, as you set up your push notification campaign (either through the [dashboa

By default, when website deeplinks are opened inside the app by Braze, they are handled by [`BrazeWebViewActivity`][udl-4]. To change this:

**1.** Create a new Activity that handles the target URL from `Intent.getExtras()` with the key `com.appboy.Constants.BRAZE_WEBVIEW_URL_EXTRA`. See [`BrazeWebViewActivity.java`][udl-8] for an example.<br><br>
**1.** Create a new Activity that handles the target URL from `Intent.getExtras()` with the key `com.braze.Constants.BRAZE_WEBVIEW_URL_EXTRA`. See [`BrazeWebViewActivity.java`][udl-8] for an example.<br><br>
**2.** Add that activity to `AndroidManifest.xml` and set `exported` to `false`.

```xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The background location access permission was added in Android 10 and is require
Add the Braze boot receiver to the `application` element of your `AndroidManifest.xml`:

```xml
<receiver android:name="com.appboy.BrazeBootReceiver">
<receiver android:name="com.braze.BrazeBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Braze in-app messages and Content Cards come with a default look and feel that m
```xml
<!-- Content Cards Example -->
<style name="Braze.ContentCards.CaptionedImage.Description">
<item name="android:textColor">@color/com_appboy_description</item>
<item name="android:textColor">@color/com_braze_description</item>
<item name="android:textSize">15.0sp</item>
<item name="android:includeFontPadding">false</item>
<item name="android:paddingBottom">8.0dp</item>
<item name="android:layout_marginLeft">10.0dp</item>
<item name="android:layout_marginRight">10.0dp</item>
<item name="android:layout_marginTop">8.0dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_below">@id/com_appboy_content_cards_captioned_image_card_title_container</item>
<item name="android:layout_below">@id/com_braze_content_cards_captioned_image_card_title_container</item>
</style>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ fragment.setContentCardUpdateHandler(cardUpdateHandler)

If the [`ContentCardsFragment`][49] determines that a Content Card refresh has failed, it will display a network connection error message.

A special adapter, the [`EmptyContentCardsAdapter`][50] replaces the standard [`ContentCardAdapter`][53] to display the error message. To set the custom message itself, override the string resource `com_appboy_feed_empty`.
A special adapter, the [`EmptyContentCardsAdapter`][50] replaces the standard [`ContentCardAdapter`][53] to display the error message. To set the custom message itself, override the string resource `com_braze_feed_empty`.

The style used to display this message can be found via [`Braze.ContentCardsDisplay.Empty`][52] and is reproduced in the following code snippet:

```xml
<style name="Braze.ContentCardsDisplay.Empty">
<item name="android:lineSpacingExtra">1.5dp</item>
<item name="android:text">@string/com_appboy_feed_empty</item>
<item name="android:text">@string/com_braze_feed_empty</item>
<item name="android:textColor">@color/com_braze_content_card_empty_text_color</item>
<item name="android:textSize">18.0sp</item>
<item name="android:gravity">center</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Note that if this functionality is disabled, the host activity's hardware back b
The default and historical value is `false`, meaning clicks outside the modal will not close the modal. Setting this value to `true` will result in the modal in-app message being dismissed when the user taps outside of the in-app message. This behavior can be toggled on by calling:

```java
AppboyInAppMessageManager.getInstance().setClickOutsideModalViewDismissInAppMessageView(true)
BrazeInAppMessageManager.getInstance().setClickOutsideModalViewDismissInAppMessageView(true)
```

[96]: https://appboy.github.io/appboy-android-sdk/kdoc/braze-android-sdk/com.braze.ui.inappmessage/-in-app-message-manager-base/set-back-button-dismisses-in-app-message-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ class CustomSlideUpInAppMessageViewWrapper extends DefaultInAppMessageViewWrappe
{% tabs %}
{% tab Kotlin %}
**Supply a custom factory to return your custom wrapper**<br>
In order to ensure that the Braze SDK uses your custom wrapper, you also need to supply a custom `IInAppMessageViewWrapperFactory` implementation that returns your custom wrapper. You can either implement the `IInAppMessageViewWrapperFactory` directly, or subclass `AppboyInAppMessageViewWrapperFactory` and only override the `createInAppMessageViewWrapper` method:
In order to ensure that the Braze SDK uses your custom wrapper, you also need to supply a custom `IInAppMessageViewWrapperFactory` implementation that returns your custom wrapper. You can either implement the `IInAppMessageViewWrapperFactory` directly, or subclass `BrazeInAppMessageViewWrapperFactory` and only override the `createInAppMessageViewWrapper` method:

```kotlin
class CustomInAppMessageViewWrapperFactory : AppboyInAppMessageViewWrapperFactory() {
class CustomInAppMessageViewWrapperFactory : BrazeInAppMessageViewWrapperFactory() {

override fun createInAppMessageViewWrapper(
inAppMessageView: View?,
Expand Down Expand Up @@ -176,10 +176,10 @@ class CustomInAppMessageViewWrapperFactory : AppboyInAppMessageViewWrapperFactor
{% endtab %}
{% tab Java %}
**Supply a custom factory to return your custom wrapper**<br>
In order to ensure that the Braze SDK uses your custom wrapper, you also need to supply a custom `IInAppMessageViewWrapperFactory` implementation that returns your custom wrapper. You can either implement the `IInAppMessageViewWrapperFactory` directly, or subclass `AppboyInAppMessageViewWrapperFactory` and only override the `createInAppMessageViewWrapper` method:
In order to ensure that the Braze SDK uses your custom wrapper, you also need to supply a custom `IInAppMessageViewWrapperFactory` implementation that returns your custom wrapper. You can either implement the `IInAppMessageViewWrapperFactory` directly, or subclass `BrazeInAppMessageViewWrapperFactory` and only override the `createInAppMessageViewWrapper` method:

```java
class CustomInAppMessageViewWrapperFactory extends AppboyInAppMessageViewWrapperFactory {
class CustomInAppMessageViewWrapperFactory extends BrazeInAppMessageViewWrapperFactory {
@Override
public IInAppMessageViewWrapper createInAppMessageViewWrapper(View inAppMessageView,
IInAppMessage inAppMessage,
Expand Down Expand Up @@ -216,25 +216,25 @@ class CustomInAppMessageViewWrapperFactory extends AppboyInAppMessageViewWrapper
{% tabs %}
{% tab Kotlin %}
**Register your factory with Braze**<br>
Once you've created your custom wrapper factory, register it with the Braze SDK via the `AppboyInAppMessageManager`:
Once you've created your custom wrapper factory, register it with the Braze SDK via the `BrazeInAppMessageManager`:

```kotlin
AppboyInAppMessageManager.getInstance().setCustomInAppMessageViewWrapperFactory(CustomInAppMessageViewWrapperFactory())
BrazeInAppMessageManager.getInstance().setCustomInAppMessageViewWrapperFactory(CustomInAppMessageViewWrapperFactory())
```
{% endtab %}
{% tab Java %}
**Register your factory with Braze**<br>
Once you've created your custom wrapper factory, register it with the Braze SDK via the `AppboyInAppMessageManager`:
Once you've created your custom wrapper factory, register it with the Braze SDK via the `BrazeInAppMessageManager`:

```java
AppboyInAppMessageManager.getInstance().setCustomInAppMessageViewWrapperFactory(new CustomInAppMessageViewWrapperFactory());
BrazeInAppMessageManager.getInstance().setCustomInAppMessageViewWrapperFactory(new CustomInAppMessageViewWrapperFactory());
```
{% endtab %}
{% endtabs %}

### Custom modal in-app message

An `AppboyInAppMessageModalView` can be subclassed to leverage a `Spinner` offering engaging ways to collect valuable user attributes. The following example shows how you can use Connected Content to capture custom attributes from a dynamic list of items. Visit the [`TeamPickerView`](https://github.com/braze-inc/braze-growth-shares-android-demo-app/blob/main/app/src/main/java/com/braze/advancedsamples/inapp/modal/TeamPickerView.kt) to get started.
A `BrazeInAppMessageModalView` can be subclassed to leverage a `Spinner` offering engaging ways to collect valuable user attributes. The following example shows how you can use Connected Content to capture custom attributes from a dynamic list of items. Visit the [`TeamPickerView`](https://github.com/braze-inc/braze-growth-shares-android-demo-app/blob/main/app/src/main/java/com/braze/advancedsamples/inapp/modal/TeamPickerView.kt) to get started.

{% tabs %}
{% tab Kotlin %}
Expand All @@ -250,7 +250,7 @@ override fun createInAppMessageView(activity: Activity, inAppMessage: IInAppMess
//...
else -> {
//Defer to default
AppboyInAppMessageManager
BrazeInAppMessageManager
.getInstance()
.getDefaultInAppMessageViewFactory(inAppMessage).createInAppMessageView(activity, inAppMessage)
}
Expand All @@ -269,7 +269,7 @@ public View createInAppMessageView(Activity activity, IInAppMessage inAppMessage
return getCustomPickerView(activity, inAppMessage);
} else {
//Defer to default
AppboyInAppMessageManager
BrazeInAppMessageManager
.getInstance()
.getDefaultInAppMessageViewFactory(inAppMessage)
.createInAppMessageView(activity, inAppMessage);
Expand Down Expand Up @@ -332,7 +332,7 @@ Using the view subclass, after a user presses submit, pass the attribute with it
```kotlin
override fun onClick(v: View?) {
val selectedTeam = spinner.selectedItem as String;
Appboy.getInstance(ctx).getCurrentUser<AppboyUser>()?.setCustomUserAttribute("FavoriteTeam", selectedTeam)
Braze.getInstance(ctx).getCurrentUser<BrazeUser>()?.setCustomUserAttribute("FavoriteTeam", selectedTeam)
messageClickableView.performClick()
}
```
Expand All @@ -345,15 +345,15 @@ Using the view subclass, after a user presses submit, pass the attribute with it
@Override
public void onClick(View v) {
String selectedTeam = (String)spinner.selectedItem ;
Appboy.getInstance(ctx).getCurrentUser().setCustomUserAttribute("FavoriteTeam", selectedTeam)
Braze.getInstance(ctx).getCurrentUser().setCustomUserAttribute("FavoriteTeam", selectedTeam)
messageClickableView.performClick()
}
```
{% endtab %}
{% endtabs %}

### Custom full in-app message
Implementing a fully custom immersive (full screen) in-app message involves a similar approach outlined in the section for implementing a [customized modal in-app message](#custom-modal-in-app-message). In this instance, however, simply extend `AppboyInAppMessageFullView` and customize as needed. Remember that the view will be displayed over the application UI, and views in Android by default are transparent. This means you will need to define a background such that the in-app message obscures the content behind it. By extending `AppboyInAppMessageFullView`, the Braze SDK will handle intercepting touch events on the view and take the appropriate action. Like with the modal example, you can override this behavior for certain controls (like `Switch` controls) to collect feedback from the user.
Implementing a fully custom immersive (full screen) in-app message involves a similar approach outlined in the section for implementing a [customized modal in-app message](#custom-modal-in-app-message). In this instance, however, simply extend `BrazeInAppMessageFullView` and customize as needed. Remember that the view will be displayed over the application UI, and views in Android by default are transparent. This means you will need to define a background such that the in-app message obscures the content behind it. By extending `BrazeInAppMessageFullView`, the Braze SDK will handle intercepting touch events on the view and take the appropriate action. Like with the modal example, you can override this behavior for certain controls (like `Switch` controls) to collect feedback from the user.

{% tabs %}
{% tab Kotlin %}
Expand All @@ -371,7 +371,7 @@ override fun createInAppMessageView(activity: Activity, inAppMessage: IInAppMess
}
else -> {
//Defer to default
AppboyInAppMessageManager
BrazeInAppMessageManager
.getInstance()
.getDefaultInAppMessageViewFactory(inAppMessage).createInAppMessageView(activity, inAppMessage)
}
Expand All @@ -392,7 +392,7 @@ public View createInAppMessageView(Activity activity, IInAppMessage inAppMessage
return getCustomImmersiveView(activity, inAppMessage); // new customization
} else {
//Defer to default
AppboyInAppMessageManager
BrazeInAppMessageManager
.getInstance()
.getDefaultInAppMessageViewFactory(inAppMessage)
.createInAppMessageView(activity, inAppMessage);
Expand Down Expand Up @@ -464,7 +464,7 @@ Using the view subclass, after a user toggles one of the switches, pass the asso

```kotlin
fun logClick(value:String, checked:Boolean){
Appboy.getInstance(ctx).logCustomEvent("SwitchChanged", BrazeProperties())
Braze.getInstance(ctx).logCustomEvent("SwitchChanged", BrazeProperties())
}

inner class OptionViewHolder(item: View): RecyclerView.ViewHolder(item), View.OnClickListener{
Expand Down Expand Up @@ -495,7 +495,7 @@ Using the view subclass, after a user toggles one of the switches, pass the asso

```java
private void logClick(String value, boolean checked){
Appboy.getInstance(ctx).logCustomEvent("SwitchChanged", new BrazeProperties());
Braze.getInstance(ctx).logCustomEvent("SwitchChanged", new BrazeProperties());
}

private class OptionViewHolder extends RecyclerView.ViewHolder, implements View.OnClickListener{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Client apps that obfuscate Braze code must store release mapping files for Braze

```
-keep class bo.app.** { *; }
-keep class com.appboy.** { *; }
-keep class com.braze.** { *; }
```

## Enabling verbose logging {#android-verbose-logging}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Create a class that implements [`IFeedClickActionListener`][37]. Implement the `

## Step 2: Instruct Braze to use your News Feed click listener

Once your `IFeedClickActionListener` is created, call `AppboyFeedManager.getInstance().setFeedCardClickActionListener()` to instruct `AppboyFeedManager` to use your custom `IFeedClickActionListener`.
Once your `IFeedClickActionListener` is created, call `BrazeFeedManager.getInstance().setFeedCardClickActionListener()` to instruct `BrazeFeedManager` to use your custom `IFeedClickActionListener`.

[37]: https://github.com/Appboy/appboy-android-sdk/blob/master/android-sdk-ui/src/main/java/com/appboy/ui/feed/listeners/IFeedClickActionListener.java
[37]: https://github.com/Appboy/appboy-android-sdk/blob/master/android-sdk-ui/src/main/java/com/braze/ui/feed/listeners/IFeedClickActionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The following is a description of the themeable Braze UI elements and their name

Braze allows setting a custom font using the [font family guide][40]. To use it, override a style for cards and use the `fontFamily` attribute to instruct Braze to use your custom font family.

For example, to update the font on all titles for short news cards, override the `Appboy.Cards.ShortNews.Title` style and reference your custom font family. The attribute value should point to a font family in your `res/font` directory.
For example, to update the font on all titles for short news cards, override the `Braze.Cards.ShortNews.Title` style and reference your custom font family. The attribute value should point to a font family in your `res/font` directory.

Here is a truncated example with a custom font family, `my_custom_font_family`, referenced on the last line:

Expand All @@ -89,4 +89,4 @@ Here is a truncated example with a custom font family, `my_custom_font_family`,
</style>
```

[40]: {{site.baseurl}}/developer_guide/platform_integration_guides/android/advanced_use_cases/font_customization/#font-customization
[40]: {{site.baseurl}}/developer_guide/platform_integration_guides/android/advanced_use_cases/font_customization/#font-customization
Loading