Logo
  • Home
  • Features
  • About Us
  • Blog
DE Talk with an expert Login Get started for free

Initialization and configuration

configure

fun configure(config: GCLocationConfig, appContext: Context)

configure is a crucial method used to initialize the SDK. It must be called first to set up the SDK before any other methods are used. This function sets the application context and necessary configuration parameters required for the SDK's operation, ensuring that all subsequent methods have the context they need to perform correctly.

setUserId

fun setUserId(userId: String?, encrypt: Boolean = true)

Sets the user ID to be used when sending location data. This method allows you to specify a user ID, which can optionally be encrypted using the SHA-256 algorithm for enhanced security before storing it locally. It is crucial to configure the user ID for tracking and personalizing location-based services within the SDK.

Example usage:

GCLocation.setUserId("exampleUserId", true)

generateUserId

fun generateUserId(): String

Generates a new random user ID using the UUID Version 4 format. This method creates a unique identifier that can be used as a user ID for tracking purposes. In combination with the setUserId method, it allows the implementation of dynamic user identification when initializing the location tracking features.

return: String containing a newly generated UUID Version 4.

Example usage:

// Generate a new random user ID
val newUserId = GCLocation.generateUserId()

// Set the generated user ID for tracking purposes
GCLocation.setUserId(newUserId, true)

hasUserData

fun hasUserData(): Boolean

Determines whether the user's data has been configured and is available within the SDK. This method checks if the user-specific information, which can be set using the setUserId method, is present. This information is crucial for enabling location tracking features and ensuring the functionality of personalized services. It helps in validating that all necessary user data is set up before proceeding with further operations.

return: Boolean indicating whether user data is configured.

Example usage:

// Set the user ID
GCLocation.setUserId("exampleUserId", true)

// Check if user data is available
if (GCLocation.hasUserData()) {
    // Proceed with starting location tracking if user data is available
    GCLocation.startTracking()
} else {
    // Handle the case where user data is not set
    println("User data is not set. Please configure user information.")
}

clearUserData

fun clearUserData()

Removes all stored user data, typically used during logout to ensure privacy and reset the application for new user sessions.

Green convenience
  • Home
  • Features
  • About Us
  • Blog
  • Contact
(+49) 151 57891073
c/o TechQuatier, Platz der Einheit 2, 60327 Frankfurt am Main
GDPR compliance

Certified Data Protection - GDPR compliance 02.12.2022

Privacy policyImprint
Copyright © 2026  Green Convenience
↑