Performance Monitoring for Android Applications

Rahul Chhabria - Mar 19 '21 - - Dev Community

Android is arguably the most ubiquitous operating system in the world. Whether it's a tablet, phone, folding phone, computer, TV, or IoT device, chances are you’ve interacted with Android OS. And to help developers get full visibility into how their customers experience Android's myriad applications, we’re extending Performance to Android.

Alt Text

Being an Android developer means thinking through countless scenarios. If something goes wrong, you need to imagine what that support ticket would look like. That means collecting everything from hardware model to software version, in addition to crucial details like screen orientation and battery level. Sentry provides all of that context out of the box — and has done so for some time. And if your users lose their connection while encountering an error, Sentry still captures these events so they can be reported back when the app restarts.

Alt Text

But errors are only half of the story. Android developers also need to see how their application performs. That means visibility into when a user writes to disk, fetches media, or loads an object in a given viewport. Without this data, untreated performance problems run the risk of becoming serious errors. But now that you have Sentry’s performance monitoring, you can finally connect your user’s frustrated taps to its poor-performing backend call.

Alt Text

To install the Android SDK, add it to your build.gradle file:

// Make sure mavenCentral is there.
repositories {
    mavenCentral()
}

// Enable Java 1.8 source compatibility if you haven't yet.
android {
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

// Add Sentry's SDK as a dependency.
dependencies {
    implementation 'io.sentry:sentry-android:4.3.0'
}
Enter fullscreen mode Exit fullscreen mode

After you’ve completed setting up a project in Sentry, we'll give you a value — which we call a DSN or Data Source Name — to add to your AndroidManifest.xml file.

<application>
  <meta-data android:name="io.sentry.dsn" android:value="https://example@sentry.io/example" />
</application>
Enter fullscreen mode Exit fullscreen mode

The current version of our Android SDK supports auto instrumentation activity rendering, which can be expanded on through custom instrumentation. Additionally, in the coming weeks, you’ll be able to automatically create spans for active transactions as well as record breadcrumbs for outgoing HTTP requests.

iOS developers: if you’re getting SDK envy, rest easy knowing that Performance is on the way for you as well.

Have a friend who wants to manage releases, solve issues faster, and speed up their mobile applications? Refer them to Sentry and we’ll give them — and you — three free months on our Team plan.

To start using Sentry with Android, configure the SDK. And if you’re new to Sentry, you can try it for free today.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .