DEV Community

loizenai
loizenai

Posted on

Kotlin Firebase Cloud Messaging – How to Send Upstream Messages | Android

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

Kotlin Firebase Cloud Messaging – How to Send Upstream Messages | Android

In some Firebase Cloud Messaging tutorials, we have known way to receive Messages. Today we're gonna look at how to send Upstream Messages from an Android Client App.

Related Post: Firebase Cloud Messaging – XMPP Server example to receive Upstream Messages | Spring Integration

I. Way to do

0. Add Firebase to Android App

Follow these steps.

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):
    
    dependencies {
    // ...
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    }

apply plugin: 'com.google.gms.google-services'

1. Get Sender ID

Go to Settings of your Firebase Project in Firebase Console to get Sender ID.

2. Send an Upstream Message

Using FirebaseMessaging.send() method:

More at:

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

Kotlin Firebase Cloud Messaging – How to Send Upstream Messages | Androidac

Top comments (0)