etain avatar

Firebase In App Messaging

etainclub

Published: 08 Feb 2020 › Updated: 08 Feb 2020Firebase In App Messaging

Firebase In App Messaging

Firebase 서비스에 이런게 있네요?
In App Messaging!

앱에 보내고 싶은 메시지를 이미지와 링크와 함께 팝업으로 띄울 수 있습니다.
Remote Push Notification과도 다르고, 앱 자체에서 구현하는 Local Push notification하고도 다릅니다.

모든 앱 설치 기기에 보낼 수도 있고, 특정 기기를 선택해서 보낼 수도 있습니다.

앱 업데이트 알림 같은 거에 매우 유용해 보입니다. 사실 앱 업데이트 하고 앱을 업데이트하라고 알리고 싶었는데 마침 딱 맞는 기능입니다.

사용법

여기서는 안드로이드 기준으로 합니다. 정말 간단합니다.
공식 설정 방법:https://firebase.google.com/docs/in-app-messaging/get-started?authuser=0&platform=android

  • 프로젝트 레벨의 build.gradle에 의존 추가
dependencies {
    // ...

    // Add the In-App Messaging and Analytics dependencies:
    implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.3'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
}

공식문서의 최신 버전을 사용하라고 하는데, react-native-firebase 패키지를 사용하는 경우 에러가 발생합니다. 의존관계가 안맞는다고..
그러면 react-native-firebase 문서대로 해야 합니다.
https://rnfirebase.io/docs/v5.x.x/in-app-messaging/android

dependencies {
  // ...
  implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
}

버전이 좀 낮은 걸 사용해야 합니다.

설정은 이게 끝입니다.

테스트

  • 먼저 테스트할 기기의 APP ID를 찾습니다. android studio를 열어서 logcat에 다음과 같이 InApp으로 필터링하면 App ID를 찾을 수 있습니다.
    Screenshot from 2020-02-09 02-20-50.png

  • Firebase 콘솔에서 In-App Messaging 선택

    • 메지시 제목 입력, Card 타입의 경우 Image를 반드시 넣어야 메시지 보낼 수 있음(주의)
    • 메시지 내용, 버튼 링크 등을 입력하고 Test on Device 클릭
      Screenshot from 2020-02-09 02-09-51.png
  • App ID 입력
    Screenshot from 2020-02-09 02-10-22.png

  • 결과 확인: 앱을 한 번 껐다가 다시 실행합니다.
    Screenshot from 2020-02-09 02-10-45.png

매우 훌륭합니다!!!

Leave Firebase In App Messaging to:

Written by

이타인클럽 - 우리 동네 도움 선순환 운동

Read more #buzy posts


Best Posts From etain

We have not curated any of etainclub's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From etain