Package com.xffffff.wellfed.common
Class DBConnection
- java.lang.Object
-
- com.xffffff.wellfed.common.DBConnection
-
public class DBConnection extends java.lang.Object
Connects to the DB, getting the users unique FirestoreID to identify them. Citation: https://firebase.google .com/docs/projects/manage-installations#android
-
-
Constructor Summary
Constructors Constructor Description DBConnection(android.content.Context context)
Connects to the Firebase Firestore database, at the given subcollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.firebase.firestore.CollectionReference
getCollection(java.lang.String subcollection)
Gets the collection reference of the user's subcollection.com.google.firebase.firestore.FirebaseFirestore
getDB()
Gets the DBprotected java.lang.String
getUUID(android.content.Context context)
Gets the UUID of the device, to identify the user.
-
-
-
Constructor Detail
-
DBConnection
public DBConnection(android.content.Context context)
Connects to the Firebase Firestore database, at the given subcollection. The user is given by the FID, which is a Firebase ID given to each unique installation.- Parameters:
context
- : the context of the application
-
-
Method Detail
-
getUUID
protected java.lang.String getUUID(android.content.Context context)
Gets the UUID of the device, to identify the user. Creates a new UUID for the user if they do not already have one.- Parameters:
context
- : the context of the application- Returns:
- the UUID of the user
-
getCollection
public com.google.firebase.firestore.CollectionReference getCollection(java.lang.String subcollection)
Gets the collection reference of the user's subcollection.- Parameters:
subcollection
- the subcollection for a user to get- Returns:
- the collection that was retrieved
-
getDB
public com.google.firebase.firestore.FirebaseFirestore getDB()
Gets the DB- Returns:
- the DB
-
-