Skip to main content

HANDLING BUGS THAT CAN BE ANTICIPATED IN ANDROID APPS.

Published: · Last updated: · 3 min read
Don Peter
Cofounder and CTO, Appxiom

Let us consider a scenario where your app user initiates a payment process in your Android app. You must have an integrated payment processing platform like Stripe in your app. The outcome of the transaction can result in either success or failure. In a good number of such cases, you already know situations in the code base that can fail.

public class MyPaymentSessionListenerimplements 
PaymentSession.PaymentSessionListener {

// Called whenever the PaymentSession's data changes.
@Override
public void onPaymentSessionDataChanged(@NonNull
PaymentSessionData data) {
}

// Update UI to indicate that network communication is in
// progress or complete.
@Override
public void onCommunicatingStateChanged(boolean
isCommunicating) {
}

// Error callback which should be reported
// using a bug reporting tool.
@Override
public void onError(int errorCode, @NotNull String
errorMessage) {
}
}

Code snippet | Response callbacks from Stripe payment processing platform

If these issues that can be anticipated are unreported, it will surely make your heads scratch. So you rely on bug reporting tools like Bugsnag, Firebase or Appxiom to make your lives easier.

How to identify the right tool?

Even though developers know the location of these issues beforehand, a detailed bug report with relevant data points will help us identify the root cause and fix them fast.

Ability to set a textual description for the issue.

First we need a basic API to report such issues with a title and a detailed description of the issue.

API.collectIssue("Issue Title", "Detailed Issue Description")

Ability to collect device information

As Android ecosystem is highly fragmented, the need to get in depth device specific information is important. Bug reporting tool that you choose should be able to collect device information like brand and model of the device, screen resolution and much more to aid developers in fixing the issue.

Identifying how your users were interacting with the app.

As these issues are generic, an ideal way to figure out the root cause is to know how the user was interacting with the app. For that, we need to be aware of the list of user events that happened before the issue.

How Appxiom handles such anticipated issues

This is where the activity trail in Appxiom comes in handy. It is a chronologically ordered list of events that occurred a minute prior to the issue.

By integrating a bug reporting tool like Appxiom, you will be able to report such anticipated failure scenarios with the help of a single line Ax.reportIssue() API.

Ax.reportIssue(context, "Payment Failed", reason);

Appxiom API to report issues in Java based projects

Ax.reportIssue(this@PaymentActivity, "Payment Failed" ,reason)

Appxiom API to report issues in Kotlin based projects

All bug reports generated by Appxiom will have relevant data points like textual description of the issue, activity trail along with device and device state information.

Activity trail (app events) captured by AppxiomDevice information captured by AppxiomFor more information, visit the documentation page for Android (Java & Kotlin), iOS (Objective-C & Swift) and watchOS (Objective-C & Swift) platforms.

Visit appxiom.com to register with Appxiom. Detailed documentation is available at docs.appxiom.com.