Created
August 7, 2016 09:26
-
-
Save vincent-paing/5156ad7f1db3dd00f0714fef0cb24b4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FireBaseDatabaseManager { | |
public static FirebaseDatabase database; | |
public static DatabaseReference hotelReference; | |
public static FirebaseDatabase getDatabase() { | |
if (database == null) { | |
database = FirebaseDatabase.getInstance(); | |
database.setPersistenceEnabled(true); | |
} | |
return database; | |
} | |
public static DatabaseReference getHotelReference() { | |
if (hotelReference == null) { | |
hotelReference = getDatabase().getReference("hotels"); | |
hotelReference.keepSynced(true); | |
} | |
return hotelReference; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment