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.
Copied
- Alternatively, if you do not use Apptics BoM you can directly declare the crash tracker dependency with its version.
Copied
Note: We highly recommend using Apptics BoM to avoid unnecessary compatibility issues.
- Initialize Crash Tracker in Application onCreate() method.
Copied
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.
Copied
Get last crash info
- You can always get the previous crash information as stringified JSONObject.
Copied
,. 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.
Copied
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.
Copied
Add custom properties
A JSONObject can be logged along with the handled exception, which can help understand the scenario better.
Copied