Home > Uncategorized > Email a Crash report from a BlackBerry App

Email a Crash report from a BlackBerry App

IMG_00000101

Too often, I get a email from a user who downloaded an app saying, “my app crashed, help”, and it’s very hard to diagnose the problem if you can’t re-create the problem on your own device. So, I thought of adding a crash report screen to my BlackBerry Webworks app.

Since I use “Console.log” statements all over my apps when developing the app, then the diagnostic information is already there.

All I needed to do is declare a global variable, and then replace all my console.log’s with log(string), and then have log(string) add to this global variable. Have this visible in a <pre> tag within a page to display a crash report, like shown opposite.

The clever bit, is then to have this send an email:

 

 

 

function email(to, subject, body) {
var message = to + ‘?subject=’ + subject + ‘&body=’ + body;
blackberry.invoke.invoke({
target: ‘sys.pim.uib.email.hybridcomposer’,
action: ‘bb.action.OPEN, bb.action.SENDMAIL’,
type: ‘message/rfc822’,
uri: ‘mailto:’ + message
});
}

Which is taken from the BuiltForBlackBerry Bootstrap on Github.

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: