Skip to main content
Documentation for version v73

Functions and Classes

Public Functions

List of public SDK functions
AltcraftSDK
// SDK initialization and configuration
├─ fun initialization(context: Context, configuration: AltcraftConfiguration, complete: ((Result<Unit>) -> Unit)? = null): Unit
// Full SDK cleanup (DB, SharedPreferences, background tasks)
├─ fun clear(context: Context, onComplete: (() -> Unit)? = null): Unit
// Register a JWT provider
├─ fun setJWTProvider(provider: JWTInterface?): Unit
// Allow re-initialization of the push module in the current session
├─ fun reinitializePushModuleInThisSession(): Unit
// Base Altcraft push receiver (can be overridden)
├─ open class PushReceiver
│ // Handle an incoming push message
│ ├─ open fun pushHandler(context: Context, message: Map<String, String>): Unit
│ // Entry point for delivering a push into the SDK
│ └─ companion object
│ └─ fun takePush(context: Context, message: Map<String, String>): Unit
// Public subscription functions
├─ val pushSubscriptionFunctions: PublicPushSubscriptionFunctions
│ // Subscribe to push notifications (status = SUBSCRIBED)
│ ├─ fun pushSubscribe(
│ │ context: Context,
│ │ sync: Boolean = true,
│ │ profileFields: Map<String, Any?>? = null,
│ │ customFields: Map<String, Any?>? = null,
│ │ cats: List<DataClasses.CategoryData>? = null,
│ │ replace: Boolean? = null,
│ │ skipTriggers: Boolean? = null
│ │ ): Unit
│ // Suspend push notifications (status = SUSPENDED)
│ ├─ fun pushSuspend(
│ │ context: Context,
│ │ sync: Boolean = true,
│ │ profileFields: Map<String, Any?>? = null,
│ │ customFields: Map<String, Any?>? = null,
│ │ cats: List<DataClasses.CategoryData>? = null,
│ │ replace: Boolean? = null,
│ │ skipTriggers: Boolean? = null
│ │ ): Unit
│ // Unsubscribe from push notifications (status = UNSUBSCRIBED)
│ ├─ fun pushUnSubscribe(
│ │ context: Context,
│ │ sync: Boolean = true,
│ │ profileFields: Map<String, Any?>? = null,
│ │ customFields: Map<String, Any?>? = null,
│ │ cats: List<DataClasses.CategoryData>? = null,
│ │ replace: Boolean? = null,
│ │ skipTriggers: Boolean? = null
│ │ ): Unit
│ // Change the status of the subscription specified in JWT from suspended to subscribed; other subscriptions containing the given push token will switch from subscribed to suspended.
│ ├─ suspend fun unSuspendPushSubscription(context: Context): DataClasses.ResponseWithHttpCode?
│ // Status of the profile’s latest subscription
│ ├─ suspend fun getStatusOfLatestSubscription(context: Context): DataClasses.ResponseWithHttpCode?
│ // Status of the profile’s latest subscription for the specified push provider
│ ├─ suspend fun getStatusOfLatestSubscriptionForProvider(context: Context, provider: String? = null): DataClasses.ResponseWithHttpCode?
│ // Status of the subscription with the current device token.
│ ├─ suspend fun getStatusForCurrentSubscription(context: Context): DataClasses.ResponseWithHttpCode?
│ // Add a functional profile field (set/incr/...)
│ └─ fun actionField(key: String): ActionFieldBuilder
// Public token management functions
├─ val pushTokenFunctions: PublicPushTokenFunctions
│ // Manually save the provider token (onNewToken)
│ ├─ fun setPushToken(context: Context, provider: String, token: String): Unit
│ // Get the current device token
│ ├─ suspend fun getPushToken(context: Context): DataClasses.TokenData?
│ // Register the FCM provider
│ ├─ fun setFCMTokenProvider(provider: FCMInterface?): Unit
│ // Register the HMS provider
│ ├─ fun setHMSTokenProvider(provider: HMSInterface?): Unit
│ // Register the RuStore provider
│ ├─ fun setRuStoreTokenProvider(provider: RustoreInterface?): Unit
│ // Delete the selected provider’s token
│ ├─ suspend fun deleteDeviceToken(context: Context, provider: String, complete: () -> Unit): Unit
│ // Force token update (delete → refresh)
│ ├─ fun forcedTokenUpdate(context: Context, complete: () -> Unit): Unit
│ // Change provider priority and refresh the token
│ └─ suspend fun changePushProviderPriorityList(context: Context, priorityList: List<String>): Unit
// Public push event functions
├─ val pushEventFunction: PublicPushEventFunctions
│ // Record Altcraft push delivery (fires a delivery event)
│ ├─ fun deliveryEvent(context: Context, message: Map<String, String>? = null, uid: String? = null): Unit
│ // Record Altcraft push open (fires an open event)
│ └─ fun openEvent(context: Context, message: Map<String, String>? = null, uid: String? = null): Unit
// SDK events (single subscriber)
└─ val eventSDKFunctions: Events
// Subscribe to SDK events
├─ fun subscribe(newSubscriber: (DataClasses.Event) -> Unit): Unit
// Unsubscribe from SDK events
└─ fun unsubscribe(): Unit

Public classes

List of SDK public classes
com.altcraft.sdk.config
└─ class AltcraftConfiguration private constructor(...)
// Altcraft SDK configuration initializer:
// API URL, resource token, application details, foreground service flag,
// and push notification settings (channel, receiver modules, and provider priority).

├─ class Builder(
│ apiUrl: String, // Base Altcraft API URL (required)
│ icon: Int? = null, // Notification icon resource ID (optional)
│ rToken: String? = null, // Role token
│ usingService: Boolean = false, // Use foreground service during subscription/token update
│ serviceMessage: String? = null, // Foreground service notification text (optional)
│ appInfo: DataClasses.AppInfo? = null, // Application metadata (ID/IID/version) (optional)
│ providerPriorityList: List<String>? = null, // Push provider priority (optional)
│ pushReceiverModules: List<String>? = null, // Packages where PushReceiver can be overridden (optional)
│ pushChannelName: String? = null, // Push notification channel name (optional)
│ pushChannelDescription: String? = null // Push notification channel description (optional)
│ )
│ └─ fun build(): AltcraftConfiguration // Build a valid configuration

├─ fun getApiUrl(): String // Returns the base Altcraft API URL
├─ fun getIcon(): Int? // Returns the notification icon resource ID (optional)
├─ fun getRToken(): String? // Returns the resource token (optional)
├─ fun getUsingService(): Boolean // Indicates whether a foreground service is used during subscription/token update
├─ fun getServiceMessage(): String? // Returns the foreground service notification text (optional)
├─ fun getAppInfo(): DataClasses.AppInfo? // Returns application details (ID/IID/version) (optional)
├─ fun getProviderPriorityList(): List<String>? // Returns the push provider priority list (optional)
├─ fun getPushReceiverModules(): List<String>? // Returns the modules containing PushReceiver overrides (optional)
├─ fun getPushChannelName(): String? // Returns the notification channel name (optional)
└─ fun getPushChannelDescription(): String? // Returns the notification channel description (optional)

Public data classes

List of SDK public data classes
DataClasses
// Base SDK event (universal telemetry)
├─ open class Event(
│ function: String,
│ eventCode: Int? = null,
│ eventMessage: String? = null,
│ eventValue: Map<String, Any?>? = null,
│ date: Date = Date()
│ )

│ // Error, inherits from Event
├─ open class Error(
│ function: String,
│ eventCode: Int? = 0,
│ eventMessage: String? = null,
│ eventValue: Map<String, Any?>? = null,
│ date: Date = Date()
│ ) : Event(...)

│ // Request error with automatic retry handled by the SDK, inherits from Error
├─ class RetryError(
│ function: String,
│ eventCode: Int? = 0,
│ eventMessage: String? = null,
│ eventValue: Map<String, Any?>? = null,
│ date: Date = Date()
│ ) : Error(...)

│ // Application information (identifiers/version)
├─ data class AppInfo(
│ appID: String,
│ appIID: String,
│ appVer: String
│ )

│ // API response wrapper with HTTP code
├─ data class ResponseWithHttpCode(
│ httpCode: Int?,
│ response: Response?
│ )

│ // API response: error code/text and profile
├─ data class Response(
│ error: Int? = null,
│ @SerialName("error_text") errorText: String? = null,
│ profile: ProfileData? = null
│ )

│ // User profile data
├─ data class ProfileData(
│ id: String? = null,
│ status: String? = null,
│ @SerialName("is_test") isTest: Boolean? = null,
│ subscription: SubscriptionData? = null
│ )

│ // Current user subscription
├─ data class SubscriptionData(
│ @SerialName("subscription_id") subscriptionId: String? = null,
│ @SerialName("hash_id") hashId: String? = null,
│ provider: String? = null,
│ status: String? = null,
│ fields: Map<String, JsonElement>? = null,
│ cats: List<CategoryData>? = null
│ )

│ // Subscription category (name/title/flags)
├─ data class CategoryData(
│ name: String? = null,
│ title: String? = null,
│ steady: Boolean? = null,
│ active: Boolean? = null
│ )

│ // Device push provider token
└─ data class TokenData(
provider: String,
token: String
)