Kotlin Firebase Cloud Messaging – How to Receive Messages | Android

https://grokonez.com/android/kotlin-firebase-cloud-messaging-receive-messages-android

Kotlin Firebase Cloud Messaging – How to Receive Messages | Android

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that help us deliver messages reliably at no cost. In this tutorial, we're gonna look at way to receive Messages in an Android App using FCM.

More Practice: Kotlin Firebase Cloud Messaging – How to Subscribe TOPIC & Receive Messages | Android

I. Firebase Cloud Messaging

1. Usage

With FCM, we can:

  • notify a client that new data is available to sync.
  • send notification messages to drive user re-engagement and retention.
  • create instant messaging with a payload of up to 4KB to a client app.

    2. How to receive Messages

    2.1 Add Firebase to Android Project

  • Create new Android App including Kotlin support.
  • From menu bar, Tool -> Firebase:
    kotlin-firebase-cloud-messaging-setup-tool

  • Assistant window will be shown. Choose Cloud Messaging, then click on Setup Firebase Cloud Messaging:
    kotlin-firebase-cloud-messaging-setup-tool-2

  • At the step 1, click on Connect to Firebase:
    kotlin-firebase-cloud-messaging-setup-tool-3

  • In new Window, choose Create new Project and fill in the name of Firebase Project:
    kotlin-firebase-cloud-messaging-setup-tool-4

  • Click on Connect to Firebase, the Browser will show new Firebase Project that has just been created:
    kotlin-firebase-cloud-messaging-setup-tool-console

  • Come back to Android Studio, at the step 2, click on Add FCM to your app:
    kotlin-firebase-cloud-messaging-setup-tool-5

  • You will see a new window that shows the code will be add to build.gradle files. Click on Accept Changes:
    kotlin-firebase-cloud-messaging-setup-tool-6

  • Now view your Project under Project type, you can see google-services.json file:
    kotlin-firebase-cloud-messaging-setup-tool-7

    2.2 Check dependencies

    Open Gradle file to check what happens, we can see that some code has been added:

  • build.gradle (project-level):

    
    buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0'
    }
    }
    
  • build.gradle (App-level):

More at:

https://grokonez.com/android/kotlin-firebase-cloud-messaging-receive-messages-android

Kotlin Firebase Cloud Messaging – How to Receive Messages | Android

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

545 bài viết.
98 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 7 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 6 tháng trước
1 0
Bài viết liên quan
White
2 0
Khi mới tìm hiểu vấn đề gì đó, chúng ta thường cố gắng tìm các cài đặt và dùng thử để xem tính khả thi và “mắt thấy tay sờ”, đây cũng là tâm lý chu...
Nguyễn Hồng Phúc viết 6 năm trước
2 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
545 bài viết.
98 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!