diff --git a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/InstallReferrer.kt b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/InstallReferrer.kt index 6946dfe..bcfa28e 100644 --- a/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/InstallReferrer.kt +++ b/TrackierSDK/sdk-core/src/main/java/com/trackier/sdk/InstallReferrer.kt @@ -108,14 +108,19 @@ class InstallReferrer(private val context: Context) { try { val rd = xiaomiReferrer(state, referrerClient) referrerClient.endConnection() - continuation.resume(rd) + if (continuation.isActive) { + continuation.resume(rd) + } } catch (ex: Exception) { continuation.resumeWithException(ex) } } override fun onGetAppsServiceDisconnected() { // Handle service disconnection if needed - // For now, let's not do anything + referrerClient.endConnection() + if (continuation.isActive) { + continuation.resumeWithException(InstallReferrerException("SERVICE_DISCONNECTED")) + } } }) }