Class User
java.lang.Object
com.example.slacks_lottoevent.model.User
Singleton class representing a User.
This class provides a unique user identifier based on the device's ID.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the device ID associated with the User.static User
Returns the singleton User instance.static void
initialize
(android.content.Context context) Initializes the singleton User instance with the provided context.
-
Method Details
-
initialize
public static void initialize(android.content.Context context) Initializes the singleton User instance with the provided context.- Parameters:
context
- the application context used to initialize the User instance- Throws:
IllegalStateException
- if the method is called after the instance is already initialized
-
getInstance
Returns the singleton User instance.- Returns:
- the singleton User instance
- Throws:
IllegalStateException
- if the User instance has not been initialized
-
getDeviceId
Returns the device ID associated with the User.- Returns:
- the device ID as a
String
-