Crash Tracking

Prev Next

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:

  • 1: Uncaught

  • 2: Caught

  • 3: Custom

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:

  • Uncaught exceptions

  • Caught exceptions

  • Caught exceptions with custom messages

  • NONE: Disables crash tracking. (Default)

  • ALL: Tracks all crash types.

  • UNCAUGHT: Tracks uncaught exceptions.

  • CAUGHT: Tracks caught exceptions.

  • CUSTOM: Tracks custom exceptions.

  • UNCAUGHT_AND_CUSTOM: Tracks uncaught and custom exceptions.

  • UNCAUGHT_AND_CAUGHT: Tracks uncaught and caught exceptions.

  • CUSTOM_AND_CAUGHT: Tracks custom and caught exceptions.

trackException(
exception: Exception
)

Tracks caught exceptions.

-

trackException(
name: String,
message: String
)

Tracks caught exceptions with custom name and message.

-

Example

  1. 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)
  2. 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 :*" )
             }
         }
     }
}

  1. 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);
  2. 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 :)" );
                 }
             }
         });
     }
}