This page describes how to use the AMPLIFY Appcelerator Services Performance (APS) for native Android applications, built with Java and the Android APIs.
The Appcelerator Performance service, powered by Apteligent, monitors your application's health, crashes, and overall performance. Using Appcelerator Performance, developers are able to analyze crash reports to see why applications crashed and focus on the specific problems on user feedback.
Using Appcelerator Performance
To use the Appcelerator Performance service, add the APS library to your project, then use the APSPerformance API to add breadcrumbs, user metadata, and exception handling code to log events leading up to a crash. Login to the Appcelerator Dashboard and use the Appcelerator Performance dashboard to monitor application performance and analyze crash reports.
Setup your project
To integrate the Performance service with a new or existing Android application:
- Go to the Appcelerator Dashboard and create a new native Android application.
- Download the Services SDK and get your Performance application key.
- Unpack the Services SDK ZIP file.
- Copy the
libfolder of your Android project.
Modify the project's
AndroidManifest.xmlfile to include the following permissions:
Add the following import statements to the main Activity of the project:
In the main Activity's
onCreate()method, enable the service by calling the APSServiceManager's
enable()method. Pass the method the application context as the first argument and the APS application key as the second argument. This provides basic app monitoring and crash reporting services.
The Android application can now make additional method calls using the APSPerformance class. Before making API calls to the APSPerformance class, you need to retrieve a shared instance using the
getInstance() method. Make APSPerformance API calls using the shared instance.
Create a breadcrumb trail
To make it easier to track the events leading up to a crash, use the
method to add breadcrumbs in your code. Place breadcrumbs near events and application state changes to track problematic paths that can lead to an application crash. Append variables to your breadcrumbs to track their state. For example:
These breadcrumbs are collected and passed to the Appcelerator Performance service. To view the breadcrumbs, in the Appcelerator Performance dashboard, when viewing a specific application, click either Crash Reports or Handled Exceptions. In the list of crashes or handled errors in the right pane, click on the crash or error to view its details. Click the Breadcrumbs tab to view the breadcrumb trails leading up to the crash or error.
The most recent 100 breadcrumbs are displayed before the crash occurred. A breadcrumb can be up to 140 characters.
Add user metadata
The username appears with the crash or error reports. By default, a guest profile is created to differentiate users if a username is not specified. To retrieve this unique identifier, use the
To access the user metadata, either click on a username in a crash or error report to open a detailed view, or in the Appcelerator Peformance dashboard, when viewing a specific application, click Search by User in the left pane then in the right pane, enter a user's name to find information about them.
Log an exception
You can track handled exceptions in your application by passing a Java Exception object to the
method, which can help identify and analyze potential errors and hot spots. For example:
Exception logs are useful for tracking crashes in third-party SDKs, code that syncs data between services, or detecting bad data that is returned from a server.
To view handled errors, in the Appcelerator Peformance dashboard, when viewing a specific application, click Handled Exceptions in the left pane. A list of handled errors and statistics appears in the right pane. Click an error to view it in more detail.
Appcelerator Performance limits the logging of handled exceptions to one per minute. Up to five exceptions are buffered and are subsequently sent after the one minute limit.
Allow the user to opt-out
method to allow the user NOT to send any information to the Appcelerator Performance service. Passing
true to this method disables sending data to Appcelerator Performance.
Check for a crash
didCrashOnLastAppLoad() method to check if the application crashed in a previous session. If the method returns true, the application crashed on the last session. Note that if
setOptOutStatus() is set to true, this method always returns false.
For complete API information, see APSPerformance API.