- 5 Minutes to read
- Print
- DarkLight
Crash Tracking
- 5 Minutes to read
- Print
- DarkLight
Crash tracking allows you to analyze crashes and exceptions within your mobile application. Once enabled, parameters are automatically sent to Mapp Intelligence for analysis, but proper configuration is required for accurate insights.
Parameters
The following parameters are automatically tracked when crash tracking is enabled. They must be configured in Mapp Intelligence as Event Parameters to ensure accurate analysis:
Parameter | Description | Where to analyze |
---|---|---|
Crash - Type | Type of crash:
| metric |
Crash - Name | Name of the crash, either system-generated or custom (if custom type is used). | Navigation > Event Parameter |
Crash - Message | Message associated with the crash, system or custom. | |
Crash - Cause Message | Parsed string from the crash message. | |
Crash - Stack | Stack where the crash happened. | |
Crash - Cause Stack | Stack that caused the crash. |
Methods
To enable crash tracking in your application, use the following methods:
Method | Description | Tracking Options |
---|---|---|
enableCrashTracking(exceptionLogLevel: ExceptionType) | Enables crash tracking in global configuration. The following types can be tracked:
|
|
trackException( | Tracks caught exceptions. | - |
trackException( | Tracks caught exceptions with custom name and message. | - |
Example
Enable crash tracking in your global configuration settings:
val webtrekkConfigurations = WebtrekkConfiguration.Builder(listOf( "12345" ), "https://track.mapp.com" ) .enableCrashTracking(ExceptionType.ALL) .build() Webtrekk.getInstance().init( this , webtrekkConfigurations)
Track exceptions in your application:
//Uncaught exception trackUncaught.setOnClickListener { Integer.parseInt( "@!#" ) } //Caught exceptions trackCaught.setOnClickListener { try { Integer.parseInt( "@!#" ) } catch (e: Exception) { Webtrekk.getInstance().trackException(e) } } //Custom exceptions trackCustom.setOnClickListener { try { Integer.parseInt( "@!#" ) } catch (e: Exception) { Webtrekk.getInstance().trackException( "Hello" , "I am custom exception :)" ) }
Full Code Example
class CrashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super .onCreate(savedInstanceState)
setContentView(R.layout.activity_crash)
//Uncaught exception
trackUncaught.setOnClickListener {
Integer.parseInt( "@!#" )
}
//Caught exceptions
trackCaught.setOnClickListener {
try {
Integer.parseInt( "@!#" )
} catch (e: Exception) {
Webtrekk.getInstance().trackException(e)
}
}
//Custom exceptions
trackCustom.setOnClickListener {
try {
Integer.parseInt( "@!#" )
} catch (e: Exception) {
Webtrekk.getInstance().trackException( "Hello" , "I am custom exception :*" )
}
}
}
}
Enable crash tracking in your global configuration settings:
List<String> ids = new ArrayList<>(); ids.add( "1" ); WebtrekkConfiguration webtrekkConfiguration2 = new WebtrekkConfiguration.Builder(ids, "https://www.webtrekk.com" ) .enableCrashTracking(ExceptionType.ALL) .build(); Webtrekk.getInstance().init( this , webtrekkConfiguration);
Track exceptions in your application:
//Uncaught exception Button trackUncaught = findViewById(R.id.trackUncaught); trackUncaught.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Integer.parseInt( "@!#" ); } }); //Caught exceptions Button trackCaught = findViewById(R.id.trackCaught); trackCaught.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { try { Integer.parseInt( "@!#" ); } catch (Exception e) { Webtrekk.getInstance().trackException(e); } } }); //Custom exceptions Button trackCustom = findViewById(R.id.trackCustom); trackCaught.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { try { Integer.parseInt( "@!#" ); } catch (Exception e) { Webtrekk.getInstance().trackException( "Hello" , "I am custom exception :)" ); } } });
Full Code Example
public class CrashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_crash);
//Uncaught exception
Button trackUncaught = findViewById(R.id.trackUncaught);
trackUncaught.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
Integer.parseInt( "@!#" );
}
});
//Caught exceptions
Button trackCaught = findViewById(R.id.trackCaught);
trackCaught.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Integer.parseInt( "@!#" );
} catch (Exception e) {
Webtrekk.getInstance().trackException(e);
}
}
});
//Custom exceptions
Button trackCustom = findViewById(R.id.trackCustom);
trackCaught.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Integer.parseInt( "@!#" );
} catch (Exception e) {
Webtrekk.getInstance().trackException( "Hello" , "I am custom exception :)" );
}
}
});
}
}