+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Initializing your app to capture crash data

An app crash is recorded when an unhandled exception occurs and causes the program to be in an unrecoverable state. Before the app closes, the MobileFirst Analytics SDK logs a crash event. This data is sent to the server with the next logger send call.

To ensure that crash data is collected and included in the MobileFirst Analytics Console reports, make sure the crash data is sent to the server.


Procedure

  1. Ensure that you are collecting app lifecycle events as described in Initializing your app to capture app usage.
  2. The client logs must be sent once the app is running again, in order to get the stacktrace that is associated with the crash.

    • iOS

        - (void)sendMFPAnalyticData {
          [OCLogger send];
          [[WLAnalytics sharedInstance] send];
        }
        
        // then elsewhere in the same implementation file:
        
        [NSTimer scheduledTimerWithTimeInterval:60
          target:self
          selector:@selector(sendMFPAnalyticData)
          userInfo:nil
          repeats:YES]

    • Android

        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
          @Override
          public void run() {
            Logger.send();
            WLAnalytics.send();
          }
        }, 0, 60000);

    • Cordova

        setInterval(function() {
          WL.Logger.send();
          WL.Analytics.send();
        }, 60000)

    • web

        setInterval(function() {
          ibmmfpfanalytics.logger.send();
        }, 60000);

Parent topic: Crash capture