API Development

🚨Breaking the Build 🚨- Episode 02: Surviving the Crash

😱 Your mobile app has crashed!! Don’t panic! All is not lost! In this episode, we walk you through surviving the crash and quickly getting your app up and running again by using Mobile Crash Analytics!

Subscribe to our channel and hit the 🔔 to get notified when we’ve posted a new episode!

Enjoy this episode? 👍 Like our video and share it!

This show was created by the Axway Developer Relations Team and many others at Axway!

💻 Code

Initializing the module

This will initialize the crash analytics module after com.appcelerator.aca has been added to tiapp.xml

const aca = require('com.appcelerator.aca');
Leaving Breadcrumb Trail

This code will help you track down any problems by allowing you to log where/what you have done in the app. These are only reported in the case of a handled exception or crash.

aca.leaveBreadcrumb('Opening screen:' + myscreen.id);
Adding User Metadata

This code will help you track down any problems by allowing you to log where/what your users have done in the app

aca.setUsername(username);
aca.setMetadata('lastLogin', datetime);
aca.setMetadata('gameLevel', 0);
Logging an Error (Handled Exception)

This code will allow you to track down exceptions/errors that may not cause a crash but are needed to help identify potential issues.

try {
var err = new Error('FATAL ERROR: Value cannot be null or undefined!');
if (value === null || value === undefined) throw err;
} catch (err) {
aca.logHandledException(err);
}
Allow User to Opt-Out

This code allows you to have to user opt-out of sending any crash analytics. Nothing will appear in report for this user if they do this.

// Disable sending data to Crash Analytics
aca.setOptOutStatus(true);

🔗 Links

  • AMPLIFY Crash Analytics Docs

👏 Credits

  • Executive Producer: Todd Holbrook
  • Marketing and Communications: Erin Bailey
  • Host / DevRel: Brenton House

📚Learn More

Check out the developer resources available below!

📣 Feedback

Have an idea or a comment? Join in the conversation here!