Skip to main content
Version: 1.0.0

Appxiom Issue Callback Listener - Code level Error Detection Notification

The Appxiom SDK provides a powerful callback listener system that enables real-time monitoring of all issues detected in your Android application. Use the Ax.listenForIssue() API to implement custom error handling, logging, or user notification systems.

Step 1: Register the Global Listener

Add the issue listener in your Application class onCreate() method. Register only a single global listener to receive callbacks for all issues detected by the SDK.

Application Class Implementation:

public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

// Initialize Appxiom SDK
Ax.init(this, appKey, platformKey);

// Register global issue listener
Ax.listenForIssue(new IssueFoundListener() {
@Override
public void issueFoundInBackgroundThread(IssueView issue) {
// Handle issue detection
handleIssueDetected(issue);
}
});
}

private void handleIssueDetected(IssueView issue) {
// Custom issue handling logic
Log.d("AppxiomIssue", "Issue detected: " + issue.getDetailedDescription());

// Switch to UI thread for UI operations
new Handler(Looper.getMainLooper()).post(() -> {
// Update UI or show notifications
showIssueNotification(issue);
});
}
}

Step 2: Implement Custom Issue Handling

The callback provides an IssueView object containing issue properties that are synchronized to the server, ensuring complete transparency in the monitoring process.

Important Threading Considerations:

  • The callback executes in a background thread
  • Use UI thread (Handler/runOnUiThread) for UI-related operations, if needed.
  • The callback triggers immediately after issue occurrence

Comprehensive IssueView Field Reference

type

Data Type: byte | Availability: Mandatory for all issues

Identifies the specific type of issue detected. Each issue type has a unique code for easy categorization and handling.

Complete Issue Type Reference:

TypeCategoryDescriptionDocumentation
1CustomReport Custom IssuesView Details
2FunctionFunction returns NullView Details
3FunctionFunction returns value outside rangeView Details
4FunctionFunction returns unexpected boolean valueView Details
5PerformanceDelayed function executionView Details
6PerformanceScreen loading delaysView Details
7FeatureTrack feature failuresView Details
8Not Applicable for Android
9MemoryLow memory warningView Details
10Not Applicable for Android
11CrashCrash ReportingView Details
12ExceptionReport ExceptionsView Details
13NetworkError in Status CodeView Details
14NetworkException during network callView Details
15NetworkDelayed network callView Details
16Not Applicable for Android
17MemoryAbnormal Memory UsageView Details
18NetworkDuplicate network callView Details
19Not Applicable for Android
20MemorySpike in Memory UsageView Details
21MemoryMemory leaksView Details
22Not Applicable for Android
23PerformanceFrozen framesView Details
24PerformanceSlow framesView Details
25ANRANR issuesView Details
26Not Applicable for Android
27ANRForce close due to ANRView Details
28Not Applicable for Android
29StartupCold App Startup delaysView Details
30StartupWarm App Startup delaysView Details
31StartupHot App Startup delaysView Details

severity

Data Type: byte | Availability: Mandatory

Indicates the severity level of the detected issue. Available severity levels:

  • MINOR: Low impact issues
  • MAJOR: Significant issues affecting functionality
  • FATAL: Critical issues requiring immediate attention

detailedDescription

Data Type: String | Availability: Mandatory

Descriptive information about the specific event that triggered the issue.

occurrenceTime

Data Type: Long (UNIX Epoch) | Availability: Mandatory

Timestamp indicating when the issue occurred, expressed in milliseconds since the Unix epoch.

location

Data Type: String | Availability: Optional

Geographic or logical location where the issue occurred, useful for distributed applications or location-based debugging.

deviceState

Data Type: JSONObject | Availability: Mandatory

Comprehensive device state information including:

  • Battery level
  • Last reboot time
  • Timezone offset
  • Available memory
  • Network connectivity status

customIdentifier

Data Type: String | Availability: Optional

Custom identifier set by the developer using the setCustomId API. Useful for user identification or session tracking. Learn more about custom identifiers.

activityTrail

Data Type: JSONArray | Availability: Optional

Chronologically ordered list of lifecycle events and custom markers, providing context for issue occurrence. Learn more about activity trail.

functionId

Data Type: String | Availability: Optional (Function and Feature tracking)

Function identifier specified in the @AX annotation for function and feature tracking, if set by developer.

functionName

Data Type: String | Availability: Optional (Function and Feature tracking)

Name of the function where the issue occurred, if available in function and feature tracking.

nextFunctionId

Data Type: String | Availability: Optional (Function and Feature tracking)

For feature tracking, the identifier of the next function in the chain, as specified in the @AX annotation.

functionParameters

Data Type: JSONArray | Availability: Optional (Function and Feature tracking)

Parameters passed to the tracked function when the issue occurred.

returnValue

Data Type: String | Availability: Optional (Function and Feature tracking)

The return value of the tracked function when the issue was detected.

returnValueType

Data Type: String | Availability: Optional (Function and Feature tracking)

Data type of the function's return value.

returnValueSize

Data Type: Long | Availability: Optional (Function and Feature tracking)

Size of the return value in bytes for tracked functions.

url

Data Type: String | Availability: Optional (Network issues)

The URL of the API call when a network-related issue occurred.

method

Data Type: byte | Availability: Optional (Network issues)

HTTP method used for the network request (GET, POST, PUT, DELETE, etc.).

statusCode

Data Type: short | Availability: Optional (Network issues)

HTTP status code returned by the server for network-related issues.

networkParameters

Data Type: JSONObject | Availability: Optional (Network issues)

Detailed network information may include:

  • Request and response headers
  • Request and response body
  • Status codes
  • Timing information

stacktrace

Data Type: String | Availability: Optional (Crash and Exception issues)

Complete stack trace for crashes, ANRs, and exception-related issues.

exceptionType

Data Type: String | Availability: Optional (Crash and Exception issues)

Type of exception that caused the issue (e.g., NullPointerException, OutOfMemoryError).

exceptionLineNumber

Data Type: int | Availability: Optional (Crash and Exception issues)

Line number in the source code where the exception occurred, if available.

eventStartTime

Data Type: Long (UNIX Epoch) | Availability: Optional

Start time of the event that caused the issue, particularly useful for network calls and function tracking.

eventEndTime

Data Type: Long (UNIX Epoch) | Availability: Optional

End time of the event, particularly useful for network calls and function tracking.

expectedExecutionTime

Data Type: Long | Availability: Optional

Expected execution time set by the developer in the @AX annotation for feature tracking.

timerTime

Data Type: Long (UNIX Epoch) | Availability: Optional

Timer-related timestamp for issues involving time-based operations or delays.

timered

Data Type: boolean | Availability: Optional

Flag indicating whether the issue is related to timer-based operations or time-sensitive functionality.


Frequently Asked Questions (FAQ)

Q: How do I register an issue callback listener in my Android app?

A: Register the listener in your Application class onCreate() method using Ax.listenForIssue(). Only register one global listener to receive callbacks for all detected issues.

Q: Can I register multiple issue listeners in different parts of my app?

A: It's recommended to use only one global listener in your Application class. You can then distribute issue notifications to different parts of your app from this central listener.

Q: What thread does the issue callback execute on?

A: The callback executes on a background thread. Use Handler(Looper.getMainLooper()).post() or runOnUiThread() for any UI operations within the callback.

Q: When exactly is the issue callback triggered?

A: The callback triggers immediately after an issue is detected by the SDK, providing real-time notification of problems in your application.

Q: How can I filter issues by type in my callback listener?

A: Use the type field in the IssueView object to filter issues:

if (issue.getType() == 11) { // Crash issues
handleCrashIssue(issue);
} else if (issue.getType() == 25) { // ANR issues
handleANRIssue(issue);
}

Q: What information is available for network-related issues?

A: Network issues provide URL, HTTP method, status code, request/response headers and body, and timing information through the networkParameters field.

Q: How do I access custom data I've set for issue tracking?

A: Use the customIdentifier field to access custom IDs set via setCustomId() API, and activityTrail for custom activity markers set via setActivityMarker().

Q: Can I get stack traces for all types of issues?

A: Stack traces are available for crashes, ANRs, and exception-related issues through the stacktrace field. Other issue types may not include stack trace information.

Q: How can I determine if an issue is related to memory problems?

A: Check for issue types 9 (low memory), 17 (abnormal memory usage), 20 (memory spikes), and 21 (memory leaks).

Q: What additional context is available for network issues?

A: Network issues provides URL, HTTP method, status code, and comprehensive network parameters in the networkParameters JSONObject based on availability.

Q: My callback receives too many issues. How can I reduce noise?

A: Filter issues by severity level or type in your callback implementation.

Q: Can I test the issue callback without waiting for real issues?

A: Yes, use Ax.test() to generate a test issue that will trigger your callback listener for testing purposes.