public class

PushMessage

extends Object
java.lang.Object
   ↳ com.neomades.notification.push.PushMessage

Class Overview

Push Notification message. The push notification message is built from the message the application received from a platform push server.

Server requirements

The application server will have to provide the notification message to the push servers corresponding to the operating system the application targets (for example to target Android and iOS devices, the server will have to send notifications to Google and Apple push servers). Each push server expects a specific format for its notifications. The following section describes the format for each OS.

For Android

The implementation relies on Firebase Cloud Messaging. Please refer to Firebase documentation to have more information.

Note that the configuration of the Android project is done by NeoMAD, the only things you need to provide is the google-services.json file which can be obtained in the Firebase portal of the application.
The path of the file must be set in the URS:

 <pushservice googleServices="path_to_google_services_json"/>
 

For iOS

The implementation relies on Foundation User Notification framework.

Summary

Public Constructors
PushMessage(String payload)
This constructor is deprecated. Since NeoMAD 4.8.4. No replacement.
Public Methods
String getAlertAction()
Returns the message title.
String getAlertMessage()
Returns the message content.
int getBadge()
This method is deprecated. Since NeoMAD 4.8.4. No replacement.
String getData()
Returns the message data.
String getPayload()
This method is deprecated. Since NeoMAD 4.8.4. No replacement.
String getSound()
This method is deprecated. Since NeoMAD 4.8.4. No replacement.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PushMessage (String payload)

This constructor is deprecated.
Since NeoMAD 4.8.4. No replacement.

Build a PushMessage using the payload.

Parameters
payload the payload of the message

Public Methods

public String getAlertAction ()

Returns the message title.

Cross Platform Considerations

On Android platform, it always returns null if called in onPushMessageReceived(PushMessage) after a user clicks on the notification in the notification center.

Returns
  • the message title

public String getAlertMessage ()

Returns the message content.

Cross Platform Considerations

On Android platform, it always returns null if called in onPushMessageReceived(PushMessage) after a user clicks on the notification in the notification center.

Returns
  • the message content

public int getBadge ()

This method is deprecated.
Since NeoMAD 4.8.4. No replacement.

Returns the message badge.

Returns
  • the message badge

public String getData ()

Returns the message data.

Returns
  • the message data

public String getPayload ()

This method is deprecated.
Since NeoMAD 4.8.4. No replacement.

Returns the original payload message received from Operating System Server.

Returns
  • the original payload message received from Operating System Server

public String getSound ()

This method is deprecated.
Since NeoMAD 4.8.4. No replacement.

Returns the message sound.

Returns
  • the message sound