You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a crash in my mobile app which is happening during the startup, I do not get them in sentry. So my question is "How can I transmit the previous crash"?
On iOS there is a possibility to detect if a previous crash happened or not. It is [SentryClient.sharedClient crashedLastLaunch] . On the iOS side of my mobile app I implemented manually
Init Sentry
detect if a crash was happening
wait 2 seconds (hope that the crash is transmitted)
initialise the app
Is there a similar possibility on the Android side, how can I see the open transmissions to sentry backend?
On App restart, there's an Integration that is gonna send all the cached crashes right away, but if the App. crashes right after initing the Sentry Android SDK, that could be not long enough, true, with the flush method you would be able to do a synchronous call on App. init and wait for a time period.
hey @chreck while we don't have an API for that, there's a workaround which looks like this:
SentryAndroid.init(this);
File cacheDir = new File(getApplicationContext().getCacheDir(), "sentry");
// if you use NDK, you may check the outbox folder too, "getApplicationContext().getCacheDir()/sentry/outbox"
if (cacheDir.exists()) {
File[] files = cacheDir.listFiles();
if (files != null && files.length > 0) {
Thread.sleep(2000);
}
}
as all files are being read, sent and deleted, once it's empty, it means all of them were flushed out to Sentry.
I hope that helps you out, for now, stay tuned, thanks.
Activity
marandaneto commentedon Mar 13, 2020
hey @chreck thanks for your message.
We intend to solve that when we implement the
flushmethod of the unified API which is not done yet.See: https://github.com/getsentry/sentry-android/blob/master/sentry-core/src/main/java/io/sentry/core/SentryClient.java#L222
On App restart, there's an Integration that is gonna send all the cached crashes right away, but if the App. crashes right after initing the Sentry Android SDK, that could be not long enough, true, with the
flushmethod you would be able to do a synchronous call on App. init and wait for a time period.marandaneto commentedon Apr 8, 2020
hey @chreck while we don't have an API for that, there's a workaround which looks like this:
as all files are being read, sent and deleted, once it's empty, it means all of them were flushed out to Sentry.
I hope that helps you out, for now, stay tuned, thanks.
bruno-garcia commentedon Sep 11, 2020
We added an API on cocoa, would make it sense to add here too with the same name.
Add to unified API docs
marandaneto commentedon Apr 15, 2021
dup of #1125