Send Notification from a Push Template¶
Blocking API
¶
MessageStatus messageStatus = Backendless.Messaging.PushWithTemplate( "TemplateName" );
Non-blocking API¶
AsyncCallback<MessageStatus> callback = new AsyncCallback<MessageStatus>(
result =>
{
Console.WriteLine( $"Message published. Message ID {result.MessageId}. Message Status - {result.Status}" );
if( result.Status == PublishStatusEnum.FAILED )
System.Console.WriteLine( $"Message publish failed with error {result.ErrorMessage}" );
},
fault =>
{
System.Console.WriteLine( "Error - " + fault );
} );
Backendless.Messaging.PublishWithTemplate( "TemplateName", callback );
Backendless Console includes a code generator which creates the client-side code for publishing a push notification for a template. To access the code generator, login to Backendless Console, select your app and click the Messaging icon. Select the PUSH NOTIFICATION tab and click the Push Templates menu. There is the "show code" icon for each created template as shown below. When you click the icon, a popup is displayed with the generated code:
The displayed popup lets you select the client-side language and copy the generated code: