PHP Class paragraph1\phpFCM\Notification

Inheritance: implements JsonSerializable
Datei anzeigen Open project: paragraph1/php-fcm

Public Methods

Method Description
__construct ( $title, $body )
jsonSerialize ( )
setBadge ( integer $badge ) : Notification iOS only: will add smal red bubbles indicating the number of notifications to your apps icon
setBody ( string $body ) : Notification android/ios: the body text is the main content of the notification
setClickAction ( string $actionName ) : Notification android/ios: what should happen upon notification click. when empty on android the default activity will be launched passing any payload to an intent.
setColor ( string $color ) : Notification android only: background color of the notification icon when showing details on notifications
setIcon ( string $icon ) : Notification android only: set the name of your drawable resource as string
setSound ( string $sound ) : Notification android/ios: can be default or a filename of a sound resource bundled in the app.
setTag ( string $tag ) : Notification android only: when set notification will replace prior notifications from the same app with the same tag.
setTitle ( string $title ) : Notification android only: notification title (also works for ios watches)

Method Details

__construct() public method

public __construct ( $title, $body )

jsonSerialize() public method

public jsonSerialize ( )

setBadge() public method

iOS only: will add smal red bubbles indicating the number of notifications to your apps icon
public setBadge ( integer $badge ) : Notification
$badge integer
return Notification

setBody() public method

android/ios: the body text is the main content of the notification
public setBody ( string $body ) : Notification
$body string
return Notification

setClickAction() public method

android/ios: what should happen upon notification click. when empty on android the default activity will be launched passing any payload to an intent.
public setClickAction ( string $actionName ) : Notification
$actionName string on android: intent name, on ios: category in apns payload
return Notification

setColor() public method

android only: background color of the notification icon when showing details on notifications
public setColor ( string $color ) : Notification
$color string in #rrggbb format
return Notification

setIcon() public method

android only: set the name of your drawable resource as string
public setIcon ( string $icon ) : Notification
$icon string the drawable name without .xml
return Notification

setSound() public method

android/ios: can be default or a filename of a sound resource bundled in the app.
See also: https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support
public setSound ( string $sound ) : Notification
$sound string a sounds filename
return Notification

setTag() public method

android only: when set notification will replace prior notifications from the same app with the same tag.
public setTag ( string $tag ) : Notification
$tag string
return Notification

setTitle() public method

android only: notification title (also works for ios watches)
public setTitle ( string $title ) : Notification
$title string
return Notification