Skip to content

Crash Report

The crash report makes it easy for apps to automatically gather uncaught exceptions and upload them to mobile services for further analysis.

When a crash happens unexpectedly, the stack trace is saved, along with device and app information, to device storage before the app terminates. The next time the user launches the app, the crash information is collected and the crash report is sent to mobile services when the network is connected.

Using CrashService

The CrashService class is central to accomplishing this functionality. CrashService takes one argument in the constructor to indicate whether it is an online OData app. Client code needs to add the CrashService instance to the SDKInitializer.start method to obtain the crash report.

After adding the CrashService instance, client code does not need any additional configuration. Capturing and sending the crash report will be performed automatically.

val isOnlineOData = true
val crashService = CrashService(isOnlineOData)
SDKInitializer.start(this, crashService)

The information sent in the crash report includes:

  • Stack trace and Thread pool
  • Application id and version
  • Build and SDK version
  • Android version
  • Device id and model name
  • Device locale and screen size
  • Timestamp of the crash
  • Network connectivity

Crash reports can be viewed using the SAP mobile service cockpit.

User consent is required in order to send out the crash report, since it may contain sensitive user information. The consent is usually obtained in the onboarding flow. For more information, please refer to crash report upload user consent. Otherwise, the client code needs to obtain the user consent and then passes the information as follows:

SDKInitializer.getService(CrashService::class)?.also { crashService ->
    crashService.consented = true
}

Important

No crash report upload will be performed if user consent has not been obtained.


Last update: February 29, 2024