Skip to content

Example: Target Individual Devices

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

DeliveryOptions deliveryOptions = DeliveryOptions()
  ..pushSinglecast = ["receiver-device-id"];

PublishOptions publishOptions = PublishOptions()
  ..headers = {
    "android-ticker-text": "You just got a private push notification!",
    "android-content-title": "This is a notification title",
    "android-content-text": "Push Notifications are cool",
    "ios-alert": "Alert message",
    "ios-badge": "1", 
    "ios-sound": "default"
  };
Backendless.messaging.publish("this is a private message!", publishOptions: publishOptions, 
  deliveryOptions: deliveryOptions).then((status) {
    print("Message status: $status");
});

Codeless Reference

The example below publishes the message to the "default" channel. This message is delivered only three devices specified in the device ids property.

push_target_individual_os_devices_1

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