use of com.backendless.geo.geofence.IGeofenceCallback in project Android-SDK by Backendless.
the class FenceDemo method startFenceMonitoring.
private void startFenceMonitoring() {
boolean useCustomCallback = ((Switch) findViewById(R.id.customCallbackToggle)).isChecked();
final String fenceName = fenceNameField.getText().toString();
IGeofenceCallback customCallback = new CustomCallBack();
if (fenceName == null || fenceName.isEmpty()) {
if (useCustomCallback) {
Backendless.Geo.startGeofenceMonitoring(customCallback, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {
Toast.makeText(FenceDemo.this, "Fences monitoring started", Toast.LENGTH_SHORT).show();
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(FenceDemo.this, "Failed: " + backendlessFault.toString(), Toast.LENGTH_LONG).show();
}
});
} else {
Backendless.Geo.startGeofenceMonitoring(geoPoint, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {
Toast.makeText(FenceDemo.this, "Fences monitoring started", Toast.LENGTH_SHORT).show();
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(FenceDemo.this, "Failed: " + backendlessFault.toString(), Toast.LENGTH_LONG).show();
}
});
}
} else {
if (useCustomCallback) {
Backendless.Geo.startGeofenceMonitoring(fenceName, customCallback, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {
Toast.makeText(FenceDemo.this, "Fence " + fenceName + " monitoring started", Toast.LENGTH_SHORT).show();
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(FenceDemo.this, "Failed: " + backendlessFault.toString(), Toast.LENGTH_LONG).show();
}
});
} else {
Backendless.Geo.startGeofenceMonitoring(fenceName, geoPoint, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {
Toast.makeText(FenceDemo.this, "Fence " + fenceName + " monitoring started", Toast.LENGTH_SHORT).show();
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
Toast.makeText(FenceDemo.this, "Failed: " + backendlessFault.toString(), Toast.LENGTH_LONG).show();
}
});
}
}
}
Aggregations