Crash Reporting¶
The mobile development kit supports crash reporting, which allows you to collect and upload crash data to SAP Mobile Services to help administrators diagnose app stability issues.
Enable Crash Reporting¶
Crash reporting is controlled by the Enable Crash Log Upload setting in the SAP mobile service cockpit under Mobile Applications > Native/MDK > your application > Client Usage and User Feedback > Configuration.
When disabled (default), no consent dialog is shown and no crash data is collected.
Consent Dialog¶
Before crash logs are uploaded, the app must obtain the user's consent. The consent dialog is shown after the onboarding and restore flows when all of the following conditions are met:
- Enable Crash Log Upload is enabled in the SAP mobile service cockpit.
- The user has not previously answered the consent dialog.
- The app is not in demo mode.
| User action | Behavior |
|---|---|
| Allow | Crash logs are collected and uploaded. Consent persists across restarts. |
| Deny | Crash logs are not uploaded. The decision is persisted. |
Once the user has answered the dialog, it is not shown again unless the user opens it from the app settings using the showCrashConsentDialog() client API.
User Consent Withdrawal¶
Users who have previously consented to crash reporting must be able to withdraw that consent at any time, in accordance with applicable privacy regulations. Since the initial consent dialog is not re-shown automatically after onboarding, it is the responsibility of the app developer to provide a way for users to re-open the consent dialog from within the app, for example, from an app settings or from the privacy page. Use the showCrashConsentDialog() API to do this. The code snippet under Client APIs illustrates a typical settings pattern. Failing to provide this option may result in your app's privacy statement being non-compliant with regulations such as GDPR and PIPL, which require that withdrawing consent be as easy as giving it.
Client APIs¶
Crash reporting is always disabled in demo mode regardless of SAP Mobile Services' crash log upload policy. The isCrashReportingEnabled() and isCurrentCrashConsentAllowed() APIs always return false in demo mode.
| API | Description |
|---|---|
isCrashReportingEnabled() |
Returns true when crash reporting is enabled in SAP Mobile Services and app is not in demo mode. |
showCrashConsentDialog() |
Programmatically displays the crash reporting consent dialog. App developers should expose the crash consent screen in the app settings so users can review or change their preference. |
isCurrentCrashConsentAllowed() |
Returns true if the user has granted consent for crash reporting. |
Typical app settings pattern:
if (clientAPI.isCrashReportingEnabled()) {
const isAllowed = clientAPI.isCurrentCrashConsentAllowed();
// show toggle reflecting isAllowed
// on tap:
clientAPI.showCrashConsentDialog();
}
Customize Consent Dialog Strings¶
The default consent dialog strings can be customized via OnboardingCustomizations in BrandedSettings.json. The following keys are available:
| Key | Default value |
|---|---|
crashReportingTitleString |
"Crash Report Collection" |
crashReportingBodyString |
"The application administrator requests that you allow data collection to diagnose and analyse app crashes for improving the app stability. Data collected is limited to crash reports and device information." |
crashReportingAllowString |
"Allow" |
crashReportingDenyString |
"Not Now" |
SAP Mobile Services recommends using the localization API for customizable strings:
"OnboardingCustomizations": {
"crashReportingTitleString": "$(L,my_crash_reporting_title)",
"crashReportingBodyString": "$(L,my_crash_reporting_msg)",
"crashReportingAllowString": "$(L,my_crash_reporting_allow_button)",
"crashReportingDenyString": "$(L,my_crash_reporting_deny_button)"
}
Behavior Notes¶
- Prior consent is remembered if crash reporting is later re-enabled in SAP Mobile Services. The consent dialog is not re-shown unless the user opens it using
showCrashConsentDialog()after onboarding. The consent decision is stored per user per device. - Changes in SAP Mobile Services are reflected on the device only when the policy is retrieved during onboarding or restoration of a user session. They are not reflected when a session is resumed.
- When crash reporting is enabled in SAP Mobile Services, crash reports are saved on the device but not uploaded until consent is provided. A crash report saved before consent is given can be uploaded during onboarding or restoration when consent is granted.
- iOS: If multiple crashes occurred but were not uploaded due to the device being offline or consent not yet given, only the latest crash report is uploaded.
- Android: If a previous crash report that has not been uploaded already exists, a new report is not generated.
- The user's consent decision is removed when the user logs out of the app or uninstalls it. The user is prompted for consent again when they re-onboard to the app.
- Crash reports are uploaded during restoration of a user session when the user relaunches the app.
- Crash reporting is always disabled in demo mode.
- If the app is offline at consent time, the crash report is queued and uploaded on the next successful connection. Note that only the latest crash report is uploaded on iOS.
Uploading of dSYM Files (iOS Only)¶
For crash reports to display readable stack traces, you must upload the symbol files for your app.
Upload dSYM files for external iOS frameworks via the Symbol Center tab in Client Usage and User Feedback in the SAP mobile service cockpit. The dSYM files for the SAP BTP SDK for iOS framework and all SAPMDC releases later than 26.9 are already registered with SAP Mobile Services and do not need to be uploaded.
For more information on how to manage the dSYM files in the Symbol Center, refer to the Mobile Services Documentation.
For more information on dSYM files, see dSYM Files.