Advanced Setup
Version tracking
Raygun4Android supports tracking the version of your application in a few different ways.
Inside the manifest
Set the versionName attribute on <manifest>
in your AndroidManifest.xml to be of the form x.x.x.x, where x is a positive integer.
When initialising the Raygun client
Set the version in the overloaded init
method when initialising the Raygun client.
RaygunClient.init(this, "YOUR_RAYGUN_API_KEY", "YOUR_APP_VERSION");
When configuring the Raygun client
Use the static setVersion
method on RaygunClient
class.
RaygunClient.setVersion("YOUR_APP_VERSION");
The applications's version will then be tracked in Real User Monitoring allowing you to see how many users are using each version of your application. For more information read about the Versions tab in Real User Monitoring.
View timing events
Once Real User Monitoring is enabled, the Raygun client will automatically report information about mobile views in your application.
Manually recording events
You are able to manually report view event timings to Raygun using the following snippet.
long milliseconds = 200;
RUM.sendRUMTimingEvent(RaygunRUMEventType.ACTIVITY_LOADED, "TestActivity", milliseconds);
Ignoring view events
You can filter out the reporting of view information by view name using the following snippet:
RaygunClient.ignoreViews(new String[]{ "MainActivity" });
Network timing events
Once Real User Monitoring is enabled, the Raygun client will automatically report the performance of network calls made with the following methods:
- java.net.HttpURLConnection
- javax.net.ssl.HttpsURLConnection
Manually recording events
You are able to manually report network event timings to Raygun using the following snippet.
long milliseconds = 200;
RUM.sendRUMTimingEvent(RaygunRUMEventType.NETWORK_CALL, "TestNetworkCall", milliseconds);
Ignoring network events
If you don't wish the performance of certain network requests to be logged, you can filter them out by URL.
RaygunClient.ignoreURLs(new String[]{ "raygun.com" });
Internal logging
For debugging purposes the provider will log information alongside the system messages. These messages can be viewed with Logcat under the tag Raygun4Android.
Raygun4Android uses Timber for internal logging. This requires some language features that are only available with Java 8. Make sure that your project using the library has set compilation compatibility to Java 8. Google's documentation has more information on the reasons and implications of this requirement.
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
The provider is open source and available at the Raygun4Android repository.