This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --location --request POST 'https://fcm.googleapis.com/fcm/send' \ | |
--header 'Authorization: key=XXX' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"notification" : { | |
"title": "Title of Your Notification", | |
"body" : "Body of Your Notification" | |
}, | |
"data": { | |
"custom_key": "XXXX" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.NotificationChannel | |
import android.app.NotificationManager | |
import android.content.Context | |
import android.os.Build | |
import android.util.Log | |
import androidx.core.app.NotificationCompat | |
import com.google.firebase.messaging.FirebaseMessagingService | |
import com.google.firebase.messaging.RemoteMessage | |
class MyFirebaseMessagingService : FirebaseMessagingService() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//project/appmodule/build.gradle | |
// Add this line | |
apply plugin: 'com.google.gms.google-services' | |
dependencies { | |
implementation("com.google.firebase:firebase-messaging:20.0.0") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
// Check that you have the following line (if not, add it): | |
google() // Google's Maven repository | |
} | |
dependencies { | |
... | |
// Add this line | |
classpath 'com.google.gms:google-services:4.3.10' | |
} |