I am looking for some guidance / recommendation for nesting async queries; calling second async after the first async has completed. I have looked through most of your examples and I finally found one where you show nesting of query in searchByDateInCategoryAsync() . Can this technique be used to nest all CRUD operation?
public void searchByDateInCategoryAsync() throws ParseException
{
// date
SimpleDateFormat dateFormat = new SimpleDateFormat( "dd.MM.yyyy 'at' HH:mm" );
final Date updated = dateFormat.parse( "17.01.2015 at 12:00" );
// create
GeoPoint geoPoint = new GeoPoint( 21.306944, -157.858333 );
geoPoint.addCategory( "Coffee" );
geoPoint.addMetadata( "Name", "Starbucks" );
geoPoint.addMetadata( "Parking", true );
geoPoint.addMetadata( "updated", new Date().getTime() );
Backendless.Geo.savePoint( geoPoint, new AsyncCallback<GeoPoint>()
{
@Override
public void handleResponse( GeoPoint geoPoint )
{
System.out.println( String.format( "searchByDateInCategory -> point: %s", geoPoint ) );
// search
BackendlessGeoQuery query = new BackendlessGeoQuery( Arrays.asList( "Coffee" ) );
query.setWhereClause( String.format( "updated > %d", updated.getTime() ) );
query.setIncludeMeta( true );
Backendless.Geo.getPoints( query, new AsyncCallback<BackendlessCollection<GeoPoint>>()
{
@Override
public void handleResponse( BackendlessCollection<GeoPoint> points )
{
System.out.println( String.format( "searchByDateInCategory GETPOINTS: %s", points.getCurrentPage() ) );
}
@Override
public void handleFault( BackendlessFault fault )
{
System.err.println( String.format( "searchByDateInCategory FAULT = %s", fault ) );
}
} );
}
@Override
public void handleFault( BackendlessFault fault )
{
System.err.println( String.format( "searchByDateInCategory SAVEPOINT: %s", fault ) );
}
} );
}