Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes get lost #130

Open
am3n opened this issue May 1, 2021 · 2 comments
Open

Crashes get lost #130

am3n opened this issue May 1, 2021 · 2 comments

Comments

@am3n
Copy link

am3n commented May 1, 2021

When the user is offline or server is stopped, and a crash occurs, the crash get lost!
After many tests and read the this sdk source code, i found the issue.
When an error occurs, the app stops quickly and the caching not apply..

https://github.com/Countly/countly-sdk-android/blob/dd79709acce513d4c8564fe06c66ab39d9a02de1/sdk/src/main/java/ly/count/android/sdk/CountlyStore.java

and i solved it temporarily by adding a long run Thread.UncaughtExceptionHandler to my App.kt class, to delay the stop time

val def = Thread.getDefaultUncaughtExceptionHandler()
val handler = Thread.UncaughtExceptionHandler { t, e ->
    sleep(500)
    def?.uncaughtException(t, e)
}
Thread.setDefaultUncaughtExceptionHandler(handler)

val config = CountlyConfig(this, countlyAppKey, countlyUrl)
...
Countly.sharedInstance().init(config)
@ArtursKadikis
Copy link
Member

Hello, could you show you full SDK initialisation code? Your code seems to indicated that there are some other calls between creating the config object and initialising the sdk.

@am3n
Copy link
Author

am3n commented May 4, 2021

        val config = CountlyConfig(this, countlyAppKey, countlyUrl)
        config.setApplication(this)
        config.setLoggingEnabled(true)
        config.setEventQueueSizeToSend(3)
        config.setUpdateSessionTimerDelay(10)
        config.setIdMode(DeviceId.Type.ADVERTISING_ID)
        config.setShouldIgnoreAppCrawlers(false)
        config.setViewTracking(true)
        config.setAutoTrackingUseShortName(true)
        config.enableCrashReporting()
        config.setCustomCrashSegment(mapOf(
            "debug" to if (BuildConfig.DEBUG) "true" else "false",
            "app_version_code" to BuildConfig.VERSION_CODE,
            "devices" to sh("Main").getString("devices", "")
        ))
        Countly.sharedInstance().init(config)
        Countly.sharedInstance().requestQueueOverwriteAppKeys()
        Countly.sharedInstance().crashes().addCrashBreadcrumb("App > onCreate() > init countly")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants