Skip to content

Example: Basic 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 push notification!" );
publishOptions.putHeader( "android-content-title", "This is a notification title" );
publishOptions.putHeader( "android-content-text", "Push Notifications are cool" );
MessageStatus status = Backendless.Messaging.publish( (Object) "Hi Devices!", 
                                                                publishOptions );

Codeless Reference

The example below publishes the message to the "default" channel. This message is delivered only to Android devices, since no values were set for iOS properties.

push_example_basic_push_1

For a detailed description of the Codeless block, refer to the Push With API topic of this guide.