Change notification sound from notification service extension - push-notification

I want to set a custom notification sound, like the whats app.
I want to modify the notification sound after getting it from the backend, but unfortunately, the didreceive notification extension method is not called.
How can I do that?

Related

How to send an actionable push notification through Ionic?

I am currently using Airnotifier and Firebase Cloud Messaging. From some other questions and after trying by myself, it seems Firebase does not support actionable notifications. Is there a way to create one somehow, or can we somehow send a request to the user's device and the application on that device can create an actionable local notification?
UPDATE: Just checked with the FCM API and SDK, title and body fields are accepted but actions and click_action are not seen anywhere. Is there a way to verify if those data have been given or if those are the correct name for the fields?
UPDATE2: gcm.notification.actions has shown in the notification received in iOS, but not click_action which I included in the notification field.
UPDATE3: It seems the "actions" field magically disappears after the "schedule" function is called in ionic's local notification plug in.

Disable automatic display of notification by firebase

I would just like to receive the notification data via the OnMessageReceived method and then display a custom notification with Unity's MobileNotification or UTNotification.
Any information in the notification property of a message is automatically handled by the system when the app is not active. If you don't want the system to automatically display a notification, make sure that your message contains no notification property. Data only messages are not displayed by the system automatically.
For more on this, also see the Firebase documentation on message types.
While it is possible to add data properties to an FCM message that is sent through the Firebase console in the Custom data section of the Additional options, there is no way to send a data only message. Messages sent through the Firebase console will always have a notification property, which is what triggers the system to display them.
If you want to send data-only messages, the simplest way is through a CURL command as shown here: How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

How can I find out about notification delivery (ti.goosh)

I use Appcelerator Titanium and I have module ti.goosh for push notification. How can I find out about notification delivery? In 'callback' I can find out about opening the notification, but I want to also know that the notification is in the device tray (for example using console.log).
I depends on what kind of message you are sending. A FCM data message is handled by the module with the NotificationCompat.Builder but if you are sending a normal FCM notification message the system is creating the notification and displaying it. You will only know if the notification was clicked by the user (like you already do) or if it arrived while the app was in foreground.

How to fix Firebase notification issue while in background mode

When my Ionic app is in foreground, notification arrives perfectly.
When my Ionic app is in background, the Firebase push notification displays the a system tray notification. Pressing the banner opens the app and the notification fires. I am completely fine with that.
But, if user decides to open the app without clicking the banner, the notification doesn't trigger. Anytime clicking the banner results into the arrival of the notification into the app.
How can I resolve this situation? How can I make the notification fire, regardless of whether the app is clicked from notification tray or normally?
Edit:
The firebase data message I'm sending looks like this :
{
"data":{
"fieldA":"A",
"fieldB" : "B",
"fieldC" : "C",
"total" : 1234,
"title" : "_my_title",
"message" : "_my_message",
"sound" : "default",
"cick_action": "FCM_PLUGIN_ACTIVITY"
},
"to":"/topics/MY_TOPIC",
"priority":"high"
}
Make sure the notification you send is of type data message, not display messages.
With FCM, you can send two types of messages to clients:
Notification messages, sometimes thought of as "display messages."
These are handled by the FCM SDK automatically.
Data messages, which
are handled by the client app.
https://firebase.google.com/docs/cloud-messaging/concept-options
Also
When in the background, apps receive the notification payload in the
notification tray, and only handle the data payload when the user taps
on the notification. When in the foreground, your app receives a
message object with both payloads available.
And
To receive messages, use a service that extends
FirebaseMessagingService. Your service should override the
onMessageReceived and onDeletedMessages callbacks.
https://firebase.google.com/docs/cloud-messaging/android/receive

How to display a notification in worklight when returning to the foreground?

I am using push notification in worklight 6.2 in one of my apps.
I have a issue regarding receiving of notification. i receive notification when i am in the application .
When i close my app or made my app go background, i receive notification in the status bar and when i click on that,its taking me to the app ask for the authentication which is provided in the app and then goes to the inbox where all the messages are listed the new message is displayed .
But when i receive the notification when my apps is in background and see the notification in status bar and without clicking that notification if i opened the application and see the inbox page ,the message is not displayed because the function which will be executed when receiving notification is not called.
I need to give solution to avoid this. Is there any way or option to display the notification which is received when the app is in background and when the app is opened without opening the notification in status bar.
Thanks in advance
Perhaps you could use a the Cordova resume event, from which you will call the pushNotificationReceived() function as the callback function.
document.addEventListener("resume", pushNotificationReceived, false);
The basic premise is that if a notification was received while you were in the background, then once returning to the foreground the above should executed and the notification will be displayed.
Again, this is just the basic premise and you'll probably need to modify the pushNotificationReceived() implementation to account for what happens when you get back to the foreground but there are no notification (you could implement some logic to check that...) and various other scenarios, as you encounter them.

Resources