인앱 메시지
인앱 메시지와 Braze SDK에 대한 설정 방법에 대해 알아보세요.
Prerequisites
이 기능을 사용하려면 먼저 Android Braze SDK를 통합해야 합니다. You’ll also need to enable in-app messages.
Message types
Braze는 메시지, 이미지, 폰트 어썸 아이콘, 클릭 액션, 분석, 색 구성표 등으로 각각 사용자 지정할 수 있는 여러 가지 기본 인앱 메시지 유형을 제공합니다.
이들의 기본 동작과 특성은 서브클래스의 IInAppMessage
라는 서브클래스의 InAppMessageBase
IInAppMessage
에는 하위 인터페이스도 포함되어 있습니다, IInAppMessageImmersive
라는 하위 인터페이스도 포함되어 있어 앱에 닫기, 클릭 액션 및 분석 버튼을 추가할 수 있습니다.
버튼 텍스트를 추가하기 전에 클릭 동작이 추가되면 버튼이 포함된 인앱 메시지의 최종 페이로드에 clickAction
메시지가 포함됩니다.
modal
인앱 메시지는 화면 중앙에 표시되며 반투명 패널로 둘러싸여 있습니다. 보다 중요한 메시징에 유용하며, 두 개의 클릭 동작과 분석 지원 버튼을 제공할 수 있습니다.
이 메시지 유형은 InAppMessageImmersiveBase
의 하위 클래스이며, IInAppMessageImmersive
을 구현하는 추상 클래스로 로컬에서 생성된 인앱 메시지에 사용자 지정 기능을 추가할 수 있는 옵션을 제공합니다.
full
인앱 메시지는 사용자 커뮤니케이션의 콘텐츠와 효과를 극대화하는 데 유용합니다. full
인앱 메시지의 상단에는 이미지가, 하단에는 텍스트와 최대 2개의 클릭 동작 및 분석 지원 버튼이 표시됩니다.
이 메시지 유형은 InAppMessageImmersiveBase
을 확장하여 로컬에서 생성된 인앱 메시지에 사용자 지정 기능을 추가할 수 있는 옵션을 제공합니다.
HTML
인앱 메시지는 완전히 맞춤화된 사용자 콘텐츠를 만드는 데 유용합니다. 사용자 정의 HTML 인앱 메시지 콘텐츠는 WebView
에 표시되며, 선택적으로 이미지 및 글꼴과 같은 다양한 형식의 기타 콘텐츠를 포함할 수 있으므로 메시지 모양과 기능을 완벽하게 제어할 수 있습니다.
이러한 메시지 인스턴스는 InAppMessageHtml
의 인스턴스이며 IInAppMessage
서브클래스를 구현합니다: IInAppMessageHtml
.
Android 인앱 메시지는 HTML 내에서 Braze 웹 SDK의 메서드를 호출하기 위해 JavaScript brazeBridge
인터페이스를 지원합니다. 자세한 내용은 모범 사례를 참조하세요.
현재 iOS 및 Android 플랫폼에서는 iFrame에 커스텀 HTML 인앱 메시지를 표시하는 기능을 지원하지 않습니다.
앱에 대한 사용자 지정 인앱 메시지 보기를 정의할 수도 있습니다. 전체 안내는 사용자 지정 공장 설정을 참조하세요.
Enabling in-app messages
Step 1: Register BrazeInAppMessageManager
In-app message display is managed by the BrazeInAppMessageManager
class. Every activity in your app must be registered with the BrazeInAppMessageManager
to allow it to add in-app message views to the view hierarchy. There are two ways to accomplish this:
The activity lifecycle callback integration handles in-app message registration automatically; no extra integration is required. This is the recommended method for handling in-app message registration.
If you’re using activity lifecycle callback for automatic registration, do not complete this step.
In your Application.onCreate()
, call ensureSubscribedToInAppMessageEvents()
:
1
BrazeInAppMessageManager.getInstance().ensureSubscribedToInAppMessageEvents(context);
1
BrazeInAppMessageManager.getInstance().ensureSubscribedToInAppMessageEvents(context)
In every activity where in-app messages can be shown, call registerInAppMessageManager()
in that activity’s onResume()
:
1
2
3
4
5
6
7
@Override
public void onResume() {
super.onResume();
// Registers the BrazeInAppMessageManager for the current Activity. This Activity will now listen for
// in-app messages from Braze.
BrazeInAppMessageManager.getInstance().registerInAppMessageManager(activity);
}
1
2
3
4
5
6
public override fun onResume() {
super.onResume()
// Registers the BrazeInAppMessageManager for the current Activity. This Activity will now listen for
// in-app messages from Braze.
BrazeInAppMessageManager.getInstance().registerInAppMessageManager(this)
}
In every activity where registerInAppMessageManager()
was called, call unregisterInAppMessageManager()
in that activity’s onPause()
:
1
2
3
4
5
6
@Override
public void onPause() {
super.onPause();
// Unregisters the BrazeInAppMessageManager for the current Activity.
BrazeInAppMessageManager.getInstance().unregisterInAppMessageManager(activity);
}
1
2
3
4
5
public override fun onPause() {
super.onPause()
// Unregisters the BrazeInAppMessageManager.
BrazeInAppMessageManager.getInstance().unregisterInAppMessageManager(this)
}
Step 2: Update the manager’s blocklist (optional)
In your integration, you may require that certain activities in your app should not show in-app messages. The activity lifecycle callback integration provides an easy way to accomplish this.
The following sample code adds two activities to the in-app message registration blocklist, SplashActivity
and SettingsActivity
:
1
2
3
4
5
6
7
8
9
10
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Set<Class> inAppMessageBlocklist = new HashSet<>();
inAppMessageBlocklist.add(SplashActivity.class);
inAppMessageBlocklist.add(SettingsActivity.class);
registerActivityLifecycleCallbacks(new BrazeActivityLifecycleCallbackListener(inAppMessageBlocklist));
}
}
1
2
3
4
5
6
7
8
9
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
val inAppMessageBlocklist = HashSet<Class<*>>()
inAppMessageBlocklist.add(SplashActivity::class.java)
inAppMessageBlocklist.add(SettingsActivity::class.java)
registerActivityLifecycleCallbacks(BrazeActivityLifecycleCallbackListener(inAppMessageBlocklist))
}
}
guide/swift/in_app_messages.md developer_ %}
guide/web/in_app_messages.md developer_ %}
guide/android_ott/in_app_messages.md developer_ %}
guide/cordova/in_app_messages.md developer_ %}
guide/flutter/in_app_messages.md developer_ %}
guide/react_native/in_app_messages.md developer_ %}
guide/roku/in_app_messages.md developer_ %}
guide/tvos/in_app_messages.md developer_ %}
guide/unity/in_app_messages.md developer_ %}
guide/xamarin/in_app_messages.md developer_ %}