Cannot target Android Channel from Azure Notifcation Hub - android-notifications

We are using Azure Notification Hub to send push notifcations to iOS and Android devices.
To ensure by that default our notifcations are displayed with an on screen popup on Android we have created a custom Channel with an id of "Default"
Using the Firebase Compose test Message UI I can send a PN and tag it with the "Default" channel. However I cannot mange to target the channel from an Azure Hub Notification. I am assuming that the JSON I am sending along with the tags and the token to NotificationHubClient.SendFcmNativeNotificationAsync is wrong
What is the correct JSON for sending a message that targets a channel?
UPDATE - WORKAROUND
Whilst I am still unable to get the Channel to be set I have found the setting in Android that says "If no channel is set use this Channel Id". It is com.google.firebase.messaging.default_notification_channel_id
<application android:label="Breathe RM" android:icon="#mipmap/app_icon" Name="Breathe RM" tools:replace="android:label">
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="Default" />
</application>
This is enough for now as we only have a single channel

Related

Getting an error while adding FCM API Key to Azure Notification Hub

I have created a Azure Notification hub namespace, I'm trying to configure the Google FCM section of it by entering the API Key, but when I do that it is giving me this error
Error updating notification hub
{"error":{"code":"BadRequest","message":"Invalid Firebase credentials."}}
The Key I added it from the google-services.json file
But when I send a notification from FCM console, I'm able to send it and receive the notification.
Any inputs would be appreciated
Azure Notification Hub doesn't support FCM (yet) but GCM as I'm writing those lines.
You need to mention the server key available under your Firebase project settings in the Cloud Messaging tab. You should see something like this:
The key that you want to mention in Azure Notifications Hub is the purple one.
If Cloud Messaging API (Legacy) is disabled (which should be the case by default since it's deprecated), just hit the 3 vertical dots on the right and navigate to the only available menu "Manage API in Google Cloud Console". And just enable it :)

Firebase Cloud Messaging - Identify delivery status for a particular push notification message

Is it possible to identify whether a particular push notification message was delivered to a particular token via Firebase Cloud Messaging? And, if so, is it possible to do so via an API call or by listening to some callback?
I know that I can look at aggregate statistics in the console and even segment those statistics through analytics tags, but cannot find a way to get more discrete information.
I also know that the API will synchronously respond if a token is invalid but the process by which Apple and Google invalidate tokens is a bit opaque (to me) and doesn't help if someone simply turned off push notifications for my app.
Thanks!
Jason
If someone turned off push notification – you can check it with code
Swift ios check if remote push notifications are enabled in ios9 and ios10
Android app - detect if app push notification is off
But user can be offline, or APNs / Firebase service – can get some problems and your notification will be drop. You can check delivery status with some code in iOS and Android applications.
If you need check, delivery status for some push you can make push notification extension (in iOS). For send status about delivered notification in your API. More info about push notification extension.
https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension
It can be helpful
https://developer.apple.com/documentation/usernotifications
https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications
https://firebase.google.com/docs/cloud-messaging/understand-delivery
https://firebase.google.com/docs/cloud-messaging/android/receive#handling_messages About handling messages in Android (you can send status delivered too)
I hope this answer will help with your problem.
UPD:
https://firebase.google.com/docs/cloud-messaging/understand-delivery
Received (available only on Android devices) — The data message or
notification message has been received by the app. This data is
available when the receiving Android device has FCM SDK 18.0.1 or
higher installed.

How to Test FCM Data Push Notifications Delivery?

I have an Azure Web Service which is using an Azure Notification Hub to push data notifications using FCM via Firebase to a Xamarin Android App. Initially the app is getting a token which is posted to the web service. The web service then sends it with the data to the notification hub which is sending it to Firebase. The response back from the hub is indicating a successful transfer it seems from the notification properties and the ReqID property. But the notification is not reaching the app. Is there a way to see individual notifications' status on the Firebase site? Currently I don't see anything under the "Cloud" report for Data.
[
Thanks for asking question! One of the notification failure point could be when sending it from FCM to user device. To confirm this, you may try getting a delivery receipt from FCM.
You may refer to this article Receive delivery receipts. It says for Android and Chrome client apps, you can get delivery receipts which can be sent from FCM to your app server. To enable this feature, the message your app server sends to FCM must include the field delivery_receipt_requested. When this field is set to true, FCM sends a delivery receipt when a device confirms that it received a particular message. Also check for firewall on the user's network.

How to set notification channel when sending messages via rest api?

I've been implementing Notification Channels in my android app to support recent android versions.
You can set the notification channel id when sending messages from the firebase web console, but I was not able to find out how to set the channel id when sending messages via fcm rest api.
Notification channels are not mentioned in the reference (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages), but I am pretty sure there must be a way to set the channel id.
The key name I was missing is android_channel_id
I found the key name in the Legacy HTTP Server Protocol docs (https://firebase.google.com/docs/cloud-messaging/http-server-ref)

Push Notification for UWP using Amazon SNS

We are developing a Xamarin UWP app that is supposed to receive Push Notifications using WNS. We are using Amazon SNS to send notifications. We made sure that the app is registering itself with proper channel URI to our backend, package name of the app is same as in the store and using Cognito credential put device token entry in Amazon application arn. I have sent raw message to device endpoint and message received in device properly. We couldn't send as Json format and tried as mentioned in below link.
https://anbu2016.wordpress.com/2016/03/17/push-notification-with-wns-and-aws-sns/
But didn't know where to receive notification from application.
For example, ReceivedRemoteNotification as override method present in iOS and it will help process the notification. In my process sent argument then based an argument, we can navigate to different page. How can we do this in UWP using JSON format.
Please help me on this.
Regards,
Cheran

Resources