Amplitude-Android
Amplitude-Android copied to clipboard
Oncorruption logging
- Added a custom onCorruption handler. Most of the code is from Android's
DefaultDatabaseErrorHandler
, I just added a call to Diagnostic logger to log an error with the current stack trace - I tried to do something fancy where I add a callback function to the corruption handler so it can also try to re-insert the metadata in the onCorruption method, but AFAIK you can't open a new database instance from inside the
DatabaseErrorHandler
class - Added some more metrics to the diagnostics logger (free / total / available heap, and free disk space)
- Also added SDK + version to the diagnostic events
Unfortunately was not able to trigger the onCorruption handler in any of the unit tests. For some reason the corrupted files trigger a SqliteException: Cannot prepare statement, base error code: 26
, instead of SQLiteDatabaseCorruptException
which triggers the onCorruption path
Could delegate to instance of default error handler. PTAL @curtisliu