My app is crashing due to high amount of data that it needs to sync. Firebase crashanalytics tells me:
Firebase Database encountered an OutOfMemoryError. You may need to reduce the amount of data you are syncing to the client
My code is like this:
public static DatabaseReference getRefFirebase() {
if (mDatabase == null) {
mDatabase = FirebaseDatabase.getInstance();
mDatabase.setPersistenceEnabled(true);
mDatabase.getReference().keepSynced(true);
}
return mDatabase.getReference();
}
So its syncing all the database. I know that this is not needed for all functions on the app but I dont know how to solve it yet. I looked for a SYNC request, so it could only sync once, but apparently Firebase has no such method. Anybody has a similar issue that could help me?