pushex v0.0.5 Pushex.Helpers
Module containing helpers functions to use Pushex functionalities easily.
Summary
Functions
See Pushex.GCM.Helpers.send_notification/2
Sends a notification asynchrnously.
The first argument can be a notification or a full request (i.e. a Pushex.GCM.Request
)
Functions
Specs
send_notification(Pushex.GCM.Request.t | map, Keyword.t) :: reference
Sends a notification asynchrnously.
The first argument can be a notification or a full request (i.e. a Pushex.GCM.Request
)
When using the first form, all the options passed will be passed to
the request (e.g. :priority
)
The function raises an exception if the request cannot be executed, for example if a parameter is missing, or the requested application is not found. If the request is executed but fails, it should be handled in the response handler.
Examples
notification = %{title: "my title", body: "my body"}
app = %Pushex.GCM.App{name: "some name", auth_key: "my_auth_key"}
reg_id = get_my_registration_id
Pushex.send_notification(notification, to: reg_id, with_app: app)
# with default_app setup
Pushex.send_notification(notification, to: reg_id, using: :gcm)
request = %Pushex.GCM.Request{app: app, notification: notification, to: reg_id}
Pushex.send_notification(request)