Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Os_fcm_notif.Data.PhoneGap

module PhoneGap : sig..end

The Cordova plugin phonegap-plugin-push interprets some payloads defined in the data key. The following module defines an interface to these payloads. You can find the payloads list here: https://github.com/phonegap/phonegap-plugin-push/blob/v2.0.x/docs/PAYLOAD.md Be aware that if you use this plugin, all attributes must be added in the data object and not in the notification object which must be empty.

Another difference is that by default with the phonegap plugin, a new notification replaces the last one, which is not the case for cordova-plugin-fcm. See Os_fcm_notif.Data.PhoneGap.add_notification_id for more information.


val add_message : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a message attribute to the notification

val add_title : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a title attribute to the notification

val add_image : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add an image to the push notification in the notification area

val add_soundname : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a soundame when the mobile receives the notification

val add_notification_id : int -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a notification ID. By default, a new notification replaces the last one because they have the same ID. By adding a different ID for two different notifications, two notifications will be shown in the notification area instead of one. If a new notification has the same ID as an older one, the new one will replace it. It is useful for chats for example.

val add_notification_channel_id : 
  string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t
module Style : sig..end
val add_style : 
  Style.t ->
  Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t
val add_summary_text : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a summary text.

module Action : sig..end
val add_actions : 
  Action.t ->
  Action.t ->
  Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add two buttons with an action (created with Os_fcm_notif.Data.PhoneGap.Action.create). Be sure you exported the callback in JavaScript.

val add_led_color : 
  int -> int -> int -> int -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Change the LED color when the notification is received. The parameters are in the ARGB format.

val add_vibration_pattern : 
  int list -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a vibration pattern

val add_badge : int -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a badge to the icon of the notification in the launcher. Only available for some launcher. The integer parameter is the number of the badge. For iOS, use Os_fcm_notif.Notification.Ios.add_badge.

module Priority : sig..end
val add_priority : 
  Priority.t ->
  Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t
val add_picture : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add a large picture in the notification (under the title and body). Don't forget to set style to the value Style.Picture.

val add_info : string -> Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add content-available: 1 also

module Visibility : sig..end
val add_visibility : 
  Visibility.t ->
  Os_fcm_notif.Data.t -> Os_fcm_notif.Data.t

Add the visibility payload