We are able to get Firestore to download records to the local cache and can read those records. However, we are unable to update a record and not able to add a new record.
Have even tried some of the same code (https://github.com/firebase/quickstart-android) but don't seem to be able to get the offline write/insert working - only read.
When we call this function offline it gets called OnFailureListner and throws an exception
@Override
public void onRating(Rating rating) {
// In a transaction, add the new rating and update the aggregate totals
addRating(mRestaurantRef, rating)
.addOnSuccessListener(this, new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "Rating added");
// Hide keyboard and scroll to top
hideKeyboard();
mRatingsRecycler.smoothScrollToPosition(0);
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Add rating failed", e);
// Show failure message and hide keyboard
hideKeyboard();
Snackbar.make(findViewById(android.R.id.content), "Failed to add rating",
Snackbar.LENGTH_SHORT).show();
}
});
}