Android SDK Method Reference
Reference for BubblSdk and related helper APIs used in Android apps.
Initialization
BubblSdk.init(application: Application, config: BubblConfig)
Initializes SDK runtime. Call once in Application.onCreate().
BubblConfig
data class BubblConfig(
val apiKey: String,
val environment: Environment = Environment.STAGING,
val segmentationTags: List<String> = emptyList(),
val geoPollInterval: Long = 5 * 60_000L,
val defaultDistance: Int = 10
)
Environment
Environment.STAGINGEnvironment.PRODUCTION
Tracking and Campaigns
BubblSdk.startLocationTracking(context: Context)
Starts location tracking service.
BubblSdk.refreshGeofence(lat: Double, lng: Double)
Refreshes geofence campaigns using explicit coordinates.
BubblSdk.forceRefreshCampaigns()
Forces campaign refresh using last known location or fallback.
BubblSdk.hasCampaigns(): Boolean
Returns true when cached campaign set is non-empty.
BubblSdk.getCampaignCount(): Int
Returns number of cached campaigns.
BubblSdk.clearCachedCampaigns()
Clears cached campaigns and resets geofence engine state.
BubblSdk.geofenceFlow: StateFlow<GeofenceSnapshot?>
Hot stream of geofence snapshots for UI/map rendering.
Segmentation and Configuration
BubblSdk.updateSegments(segmentations: List<String>, callback)
Pushes segmentation tags for current device.
BubblSdk.setCorrelationId(correlationId: String, callback)
Sets or overrides persistent correlation_id for the current install and syncs registration payload.
BubblSdk.getCorrelationId(): String
Returns stored correlation_id value (empty string if unset).
BubblSdk.clearCorrelationId(callback)
Clears stored correlation_id and syncs registration payload.
BubblSdk.getCurrentConfiguration(): Configuration?
Returns cached configuration payload.
BubblSdk.getPrivacyText(): String
Returns cached privacy text.
BubblSdk.refreshPrivacyText(callback)
Fetches latest configuration and returns privacy text.
Event and Survey APIs
BubblSdk.sendEvent(...)
Generic event reporting wrapper.
BubblSdk.cta(nId: Int, locationId: String)
Convenience CTA engagement event.
BubblSdk.trackSurveyEvent(notificationId, locationId, activity, callback)
Tracks survey/notification lifecycle event (cta_engagement, dismissed, etc).
BubblSdk.submitSurveyResponse(notificationId, locationId, answers, callback)
Submits structured survey answers.
Utility APIs
BubblSdk.sayHello(): String
Simple SDK sanity check.
BubblSdk.getApiKey: String
Read-only API key currently loaded by SDK runtime.
BubblSdk.syncFcmToken(context, token)
Syncs refreshed FCM token to backend registration endpoint.
Runtime Permission Helper (PermissionManager)
locationGranted(): Boolean
Foreground location permission check.
notificationGranted(): Boolean
Android 13+ notification permission check.
requiredPermissions(): Array<String>
Returns foreground permissions to request.
registerLauncher(onResult)
Registers Activity Result API launcher for multi-permission requests.