Don Peter

Nov 21, 20202 min

Handling bugs that can be anticipated in Android apps.

Updated: Sep 24, 2022

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 Finotes 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 Finotes handles such anticipated issues

This is where the activity trail in Finotes 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 Finotes, you will be able to report such anticipated failure scenarios with the help of a single line Fn.reportIssue() API.


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

Finotes API to report issues in Java based projects
 


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

Finotes API to report issues in Kotlin based projects


 

All bug reports generated by Finotes 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 Finotes
Device information captured by Finotes

For more information, visit the documentation page for Android (Java & Kotlin), iOS (Objective-C & Swift) and watchOS (Objective-C & Swift) platforms.

Visit finotes.com to register with Finotes. Detailed documentation is available at docs.finotes.com.