Firebase: How to set default notification channel in Android app?
As you can see here in the official docs, you need to add the following metadata element in your AndroidManifest.xml
within the application component:
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
This default channel will be used when notification message has no specified channel, or if the channel provided has not yet been created by the app.
How to specify Android notification channel for FCM push messages in Android 8
Look at docs: https://firebase.google.com/docs/cloud-messaging/http-server-ref
android_channel_id The notification's channel id (new in Android O).
The app must create a channel with this ID before any notification
with this key is received.If you don't send this key in the request, or if the channel id
provided has not yet been created by your app, FCM uses the channel id
specified in your app manifest.
Try to include android_channel_id
in json you are about to post to fcm. I have no idea why manifest value is not working for you. Try to just add channel to your request, you should get the same effect as from Firebase Console.
Edit: I just realized you are asking for Amazon client integration. Maybe you are able to build json request manually then (I don't know much about Amazon services, sorry).
Firebase messaging: default notification channel doesn't work
apologies, apparently the documentation has not been updated properly :(
The correct metadata in the manifest is:
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/notification_channel_id" />
Note the _id
at the end of the android:name
attribute value.
Will get the documentation updated asap.
Missing default Notification Channel metadata in AndroidManifest in Flutter
Adding FLUTTER_NOTIFICATION_CLICK
is required to be sent, for onResume and onLunch to be executed.
{
"notification": {...},
"click_action": "FLUTTER_NOTIFICATION_CLICK"
}
For my golang server, this meant adding the AndroidConfig
message := &messaging.Message{
Topic: topic,
Notification: &messaging.Notification{/* */}
Data: data,
APNS: &messaging.APNSConfig{/* */}
Android: &messaging.AndroidConfig{
Notification: &messaging.AndroidNotification{
ClickAction: "FLUTTER_NOTIFICATION_CLICK",
},
},
}
How do you specify a default notification channel ID in the application manifest?
Defining a default channel ID from the manifest cannot be done with standard notification channels, it only applies to Firebase notifications: Firebase: How to set default notification channel in Android app?
How can I set the android channel notification from code in firebase cloud function?
Solution: It seems that you can assign the category that you want to relate the message:
const message = {
android:{
notification:{
title: 'Game started!',
body: 'Game '+ salaName +' has started!',
channel_id: "notification.category.default",
}
},
topic: "topicName"
};
Source: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidfcmoptions
Related Topics
Speech to Text from Own Sound File
Folder Added on Android Is Not Visible via Usb
How to Know If a Fragment Is Visible
Gcm Push Notification with ASP.NET
Resizing Imageview to Fit to Aspect Ratio
Relocate Google Logo in Mapview
Firebase Authentication State Change Does Not Fire When User Is Disabled or Deleted
How to Get the Key from the Value in Firebase
How to Send File from Android Device to Other Device Through Bluetooth by Code
How to Change Actionbar Tab Indicator Programmatically
How to Get the Dreaded Write_Secure_Settings Permission for My Android App