Join our upcoming webinar on June 5, 2025 (Thursday). Register now!

Skip to main content

Before you begin, make sure that Apptics is integrated into your project by following the Integration Guide.

Add the SDK to your app

  • Declare Crash Tracker dependency using Apptics BoM.
Copieddependencies {
  // ...

  // Apptics BoM, latest version is mentioned in the integration guide.
  implementation platform('com.zoho.apptics:apptics-bom:[latest-version]')
  
  // Since BoM version is specified, no need to explicitly specify the dependency version.
  implementation 'com.zoho.apptics:apptics-crash-tracker'

}
  • Alternatively, if you do not use Apptics BoM you can directly declare the crash tracker dependency with its version.
Copieddependencies {
   // Have to explicitly mention the version, if you are not using BoM.
   // latest version is mentioned in the integration guide.
   implementation 'com.zoho.apptics:apptics-crash-tracker:[latest-version]'
}

Note: We highly recommend using Apptics BoM to avoid unnecessary compatibility issues.

  • Initialize Crash Tracker in Application onCreate() method.
CopiedApptics.init(this)

Add custom properties

Custom properties allow you to get the state of your app leading to the crash. JSONObject set using this method will be attached to the crash report, which may help you to understand and debug the crash better.

Copiedval props = JSONObject()
props.put("some key", "some value")
        
AppticsCrashTracker.customProperties = props

Get last crash info

  • You can always get the previous crash information as stringified JSONObject.
CopiedAppticsCrashTracker.getLastCrashInfo()

,. Sample JSON structure:

{ "issuename": "divide by zero", "crash": "java.lang.ArithmeticException: divide by zero\n\tat com.zoho.apptics.MainActivity(MainActivity.kt:56)", "happendat": 1636449139218, "customproperties": {}, "screenname": "com.zoho.apptics.MainActivity", "sessionstarttime": 1636449117291, "ram": "7.02 GB", "rom": "106.22 GB", "edge": "Unknown", "batteryin": 79, "orientation": 0, "serviceprovider": "Airtel", "networkbandwidth": "", "networkstatus": 0 }

Showing consent pop-up to send previous session crash info

This is an option to gently nudge the user to report the crash, that has happened while the crash tracking was turned off.

  • Call the below method on an appropriate screen in your app. This will present a pop-up only if the app has crashed in the previous sessions while the crash tracking was disabled.
CopiedAppticsCrashTracker.showLastSessionCrashedPopup(Activity)

Handled Exceptions

In addition to automatically reporting your app's crashes, Apptics also allows you to log handled exceptions (non-fatal).

Log handled exceptions

Log handled exceptions in Apptics using recordException method in AppticsCrashTracker.

Copiedtry {
    val i = 1/0
}  catch (e: Exception)  {
    AppticsNonFatals.recordException(e)
}

Add custom properties

A JSONObject can be logged along with the handled exception, which can help understand the scenario better.

Copiedval props = JSONObject()
props.put("some key", "some value")

AppticsNonFatals.recordException(e, props)