Skip to content

Unconditional Delivery Listeners

The where clause argument in the addCreateListener method is optional. When it is not provided, the real-time database will deliver any new object created in the database's table:

EventHandler<Map> orderEventHandler = Backendless.Data.of( "Order" ).rt();

orderEventHandler.addCreateListener( new AsyncCallback<Map>()
{
  @Override
  public void handleResponse( Map createdOrder )
  {
    Log.i( "MYAPP", "new Order object has been created. Object ID - " + createdOrder.get( "objectId" ) );   
  }

  @Override
  public void handleFault( BackendlessFault fault )
  {
    Log.e( "MYAPP", "Server reported an error " + fault.getDetail() );
  }
} );
EventHandler<Order> orderEventHandler = Backendless.Data.of( Order.class ).rt();

orderEventHandler.addCreateListener( new AsyncCallback<Order>()
{
  @Override
  public void handleResponse( Order createdOrder )
  {
    Log.i( "MYAPP", "new Order object has been created. Object ID - " + createdOrder.objectId );     
  }

  @Override
  public void handleFault( BackendlessFault fault )
  {
    Log.e( "MYAPP", "Server reported an error " + fault.getDetail() );
  }
} );