Skip to content

Example: Delayed Push

// do not forget to call Backendless.initApp in the app initialization code

PublishOptions publishOptions = new PublishOptions();
publishOptions.putHeader( "android-ticker-text", "You just got a private push notification!" );
publishOptions.putHeader( "android-content-title", "This is a notification title" );
publishOptions.putHeader( "android-content-text", "Push Notifications are cool" );

DeliveryOptions deliveryOptions = new DeliveryOptions();
Date publishDate = new Date( System.currentTimeMillis() + 20000 ); // add 20 seconds
deliveryOptions.setPublishAt( publishDate );

MessageStatus status = Backendless.Messaging.publish( "This message was scheduled 20 sec ago", 
                                                      publishOptions, 
                                                      deliveryOptions );