feat(android-distribution): Add update check button to Android sample#4764
feat(android-distribution): Add update check button to Android sample#4764runningcode merged 1 commit intomainfrom
Conversation
- Add sentry-android-distribution as debug-only dependency - Add "Check for Update" button to main activity UI - Implement handler that calls Sentry.distribution().checkForUpdate() - Handle all UpdateStatus types: NewRelease, UpToDate, NoNetwork, UpdateError - Display results in toast messages Note: This feature requires proper distribution tokens and configuration to work. This change makes it easier to test the distribution integration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
| Toast.makeText(this, message, Toast.LENGTH_LONG).show(); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Bug: Debug Dependency Causes Release Build Failures
The checkForUpdate button handler in MainActivity unconditionally calls Sentry.distribution().checkForUpdate() and references UpdateStatus types. Since sentry-android-distribution is a debugImplementation dependency, release builds will encounter compilation errors or runtime crashes when this code is executed.
Additional Locations (1)
There was a problem hiding this comment.
@runningcode I'm assuming cursor is incorrect here since the Sentry noop impl for sentry-android-distribution implements checkForUpdate to always return UpdateStatus.UpToDate or similar?
There was a problem hiding this comment.
Yeah good to check this. UpdateStatus is part of the api in sentry (not sentry-android-distribution) so it is always there.
The NoOpDistributionApi will be available in release builds that don’t have sentry-android-distribution and this check will always return UpdateStatus.UpToDate
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b750b96 | 408.98 ms | 480.32 ms | 71.34 ms |
| ee747ae | 357.79 ms | 421.84 ms | 64.05 ms |
| 3998a95 | 415.94 ms | 478.54 ms | 62.60 ms |
| 85d7417 | 347.21 ms | 394.35 ms | 47.15 ms |
| 806307f | 357.85 ms | 424.64 ms | 66.79 ms |
| d217708 | 409.83 ms | 474.72 ms | 64.89 ms |
| c8125f3 | 397.65 ms | 485.14 ms | 87.49 ms |
| ee747ae | 396.82 ms | 441.67 ms | 44.86 ms |
| 3699cd5 | 423.60 ms | 495.52 ms | 71.92 ms |
| f634d01 | 359.58 ms | 433.88 ms | 74.30 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| b750b96 | 1.58 MiB | 2.10 MiB | 533.19 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 3998a95 | 1.58 MiB | 2.10 MiB | 532.96 KiB |
| 85d7417 | 1.58 MiB | 2.10 MiB | 533.44 KiB |
| 806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
| d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| c8125f3 | 1.58 MiB | 2.10 MiB | 532.32 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 3699cd5 | 1.58 MiB | 2.10 MiB | 533.45 KiB |
| f634d01 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
chromy
left a comment
There was a problem hiding this comment.
lgtm w/ one question on the auto review
| Toast.makeText(this, message, Toast.LENGTH_LONG).show(); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
@runningcode I'm assuming cursor is incorrect here since the Sentry noop impl for sentry-android-distribution implements checkForUpdate to always return UpdateStatus.UpToDate or similar?
Summary
Sentry.distribution().checkForUpdate()UpdateStatustypes:NewRelease,UpToDate,NoNetwork,UpdateError#skip-changelog
Note: This feature requires proper auth tokens and configuration to work. This change makes it easier to test the distribution integration during development.
🤖 Generated with Claude Code
Note
Adds debug-only Sentry Distribution dependency and a "Check for Update" button that calls checkForUpdate and toasts status results.
MainActivity.java): Adds click handler forbinding.checkForUpdateusingSentry.distribution().checkForUpdate(...); handlesUpdateStatus.NewRelease,UpToDate,NoNetwork,UpdateErrorand showsToastmessages.res/layout/activity_main.xml): AddsButton@+id/check_for_update.res/values/strings.xml): Adds"Check for Update"string.build.gradle.kts): Adds debug-only dependencydebugImplementation(projects.sentryAndroidDistribution).Written by Cursor Bugbot for commit 8842657. This will update automatically on new commits. Configure here.