Skip to content

Instantly share code, notes, and snippets.

View ramden's full-sized avatar

Denis R. ramden

View GitHub Profile
// The view
getAllItemsView = Couchbase.getDatabaseInstance().getView("getAllItems");
getAllItemsView.setDocumentType("item");
getAllItemsView.setMap(new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
emitter.emit(document.get("title"), document);
}
}, "2");
// ##############################################################################
// Scenario 1:
// ##############################################################################
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
FirebaseDatabase.getInstance().goOffline(); // <--------NOTE THIS
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.child("users").child(App.get().getUid()).child("items").addValueEventListener(new ValueEventListener() {
@Override