JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::PushNotifications::Listener Struct Reference

Register a listener (ideally on application startup) to receive information about notifications received and any callbacks to async functions called. More...

#include <juce_PushNotifications.h>

Public Member Functions

virtual ~Listener ()=default
 
virtual void deliveredNotificationsListReceived (const Array< Notification > &notifications)
 Called after getDeliveredNotifications() request is fulfilled. More...
 
virtual void deviceTokenRefreshed (const String &token)
 Called whenever a token gets refreshed. More...
 
virtual void handleNotification (bool isLocalNotification, const Notification &notification)
 This can be called in multiple different situations, depending on the OS and the situation. More...
 
virtual void handleNotificationAction (bool isLocalNotification, const Notification &notification, const String &actionIdentifier, const String &optionalResponse)
 This can be called when a user performs some action on the notification such as pressing on an action button or responding with a text input. More...
 
virtual void localNotificationDismissedByUser (const Notification &notification)
 For iOS10 and Android, this can be also called when a user dismissed the notification before responding to it. More...
 
virtual void notificationSettingsReceived (const Settings &settings)
 This callback will be called after you call requestSettingsUsed() or requestPermissionsWithSettings(). More...
 
virtual void pendingLocalNotificationsListReceived (const Array< Notification > &notifications)
 Called when the list of pending notifications, requested by calling getPendingLocalNotifications() is returned. More...
 
virtual void remoteNotificationsDeleted ()
 Called when Firebase Cloud Messaging server deletes pending messages. More...
 
virtual void upstreamMessageSendingError (const String &messageId, const String &error)
 Called when there was an error sending an upstream message with PushNotifications::sendUpstreamMessage(). More...
 
virtual void upstreamMessageSent (const String &messageId)
 Called when an upstream message sent with PushNotifications::sendUpstreamMessage() has been sent successfully. More...
 

Detailed Description

Register a listener (ideally on application startup) to receive information about notifications received and any callbacks to async functions called.

Constructor & Destructor Documentation

◆ ~Listener()

virtual juce::PushNotifications::Listener::~Listener ( )
virtualdefault

Member Function Documentation

◆ deliveredNotificationsListReceived()

virtual void juce::PushNotifications::Listener::deliveredNotificationsListReceived ( const Array< Notification > &  notifications)
inlinevirtual

Called after getDeliveredNotifications() request is fulfilled.

Returns notifications that are visible in the notification area on the device and that are still waiting for a user action/response.

On iOS, iOS version 10 or higher is required. On Android, API level 18 or higher is required. For unsupported platforms, an empty array will be returned.

References juce::ignoreUnused().

◆ deviceTokenRefreshed()

virtual void juce::PushNotifications::Listener::deviceTokenRefreshed ( const String token)
inlinevirtual

Called whenever a token gets refreshed.

You should monitor any token updates, because only the last token that is assigned to device is valid and can be used.

References juce::ignoreUnused().

◆ handleNotification()

virtual void juce::PushNotifications::Listener::handleNotification ( bool  isLocalNotification,
const Notification notification 
)
inlinevirtual

This can be called in multiple different situations, depending on the OS and the situation.

On pre iOS 10 device it will be called when a user presses on a notification or when a notification was received when the app was in the foreground already. On iOS 10 it will be called when a user presses on a notification

Note: On Android, if remote notification was received while the app was in the background and then user pressed on it, the notification object received in this callback will contain only "properties" member set. Hence, if you want to know what was the notification title, content etc, you need to set them as additional properties, so that you will be able to restore them from "properties" dictionary.

Note you can receive this callback on startup, if the application was launched from a notification.

References juce::ignoreUnused().

◆ handleNotificationAction()

virtual void juce::PushNotifications::Listener::handleNotificationAction ( bool  isLocalNotification,
const Notification notification,
const String actionIdentifier,
const String optionalResponse 
)
inlinevirtual

This can be called when a user performs some action on the notification such as pressing on an action button or responding with a text input.

Note that pressing on a notification area, i.e. not on an action button is not considered to be an action, and hence receivedNotification() will be called in that case.

Note you can receive this callback on startup, if the application was launched from a notification's action.

Parameters
isLocalNotificationIf the notification is local
notificationThe notification
actionIdentifierA String identifying the action
optionalResponseText response a user inputs for notifications with a text input. Empty for notifications without a text input option.

References juce::ignoreUnused().

◆ localNotificationDismissedByUser()

virtual void juce::PushNotifications::Listener::localNotificationDismissedByUser ( const Notification notification)
inlinevirtual

For iOS10 and Android, this can be also called when a user dismissed the notification before responding to it.

References juce::ignoreUnused().

◆ notificationSettingsReceived()

virtual void juce::PushNotifications::Listener::notificationSettingsReceived ( const Settings settings)
inlinevirtual

This callback will be called after you call requestSettingsUsed() or requestPermissionsWithSettings().

Note that settings are currently only used on iOS. When called on other platforms, Settings with no categories and all allow flags set to true will be received in Listener::notificationSettingsReceived().

References juce::ignoreUnused().

◆ pendingLocalNotificationsListReceived()

virtual void juce::PushNotifications::Listener::pendingLocalNotificationsListReceived ( const Array< Notification > &  notifications)
inlinevirtual

Called when the list of pending notifications, requested by calling getPendingLocalNotifications() is returned.

iOS 10 or above only.

References juce::ignoreUnused().

◆ remoteNotificationsDeleted()

virtual void juce::PushNotifications::Listener::remoteNotificationsDeleted ( )
inlinevirtual

Called when Firebase Cloud Messaging server deletes pending messages.

This can happen when 1) too many messages were sent to the server (hint: use collapsible messages). 2) the devices hasn't been online in a long time (refer to Firebase documentation for the maximum time a message can be stored on FCM before expiring).

◆ upstreamMessageSendingError()

virtual void juce::PushNotifications::Listener::upstreamMessageSendingError ( const String messageId,
const String error 
)
inlinevirtual

Called when there was an error sending an upstream message with PushNotifications::sendUpstreamMessage().

Bear in mind that in may take several minutes or more to receive this callback.

References juce::ignoreUnused().

◆ upstreamMessageSent()

virtual void juce::PushNotifications::Listener::upstreamMessageSent ( const String messageId)
inlinevirtual

Called when an upstream message sent with PushNotifications::sendUpstreamMessage() has been sent successfully.

Bear in mind that in may take several minutes or more to receive this callback.

References juce::ignoreUnused().


The documentation for this struct was generated from the following file: