Conversation
| builder.setInstantAppsEnabled(true); | ||
|
|
||
| CustomTabsIntent customTabsIntent = builder.build(); | ||
| customTabsIntent.launchUrl(this, Uri.parse(DEMO_URL)); |
There was a problem hiding this comment.
Potential bug: The call to customTabsIntent.launchUrl() is not wrapped in a try-catch block, which will cause a crash if no suitable browser is found.
-
Description: The call to
customTabsIntent.launchUrl()is not wrapped in atry-catchblock to handleActivityNotFoundException. This exception will be thrown, causing the app to crash, under a few conditions. On devices running Android 11 (API 30) or newer, the crash will occur because theAndroidManifest.xmlfile is missing the required<queries>element, which prevents the app from discovering installed browsers. The crash can also happen on any Android version if the device has no browser installed or if the installed browsers do not support Custom Tabs. Past Sentry issues (1, 2) confirmActivityNotFoundExceptionis a recurring problem. -
Suggested fix: Wrap the
customTabsIntent.launchUrl()call in atry-catchblock to handleActivityNotFoundException. In thecatchblock, you can fall back to a standardACTION_VIEWintent or show an error message. Additionally, add the appropriate<queries>element toAndroidManifest.xmlto ensure browser visibility on Android 11+ devices.
severity: 0.85, confidence: 0.95
Did we get this right? 👍 / 👎 to inform future reviews.
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 23d6b12 | 354.10 ms | 408.38 ms | 54.28 ms |
| 9fbb112 | 361.43 ms | 427.57 ms | 66.14 ms |
| 1df7eb6 | 397.04 ms | 429.64 ms | 32.60 ms |
| c8125f3 | 397.65 ms | 485.14 ms | 87.49 ms |
| ee747ae | 358.21 ms | 389.41 ms | 31.20 ms |
| b750b96 | 408.98 ms | 480.32 ms | 71.34 ms |
| f634d01 | 359.58 ms | 433.88 ms | 74.30 ms |
| 806307f | 357.85 ms | 424.64 ms | 66.79 ms |
| ee747ae | 374.71 ms | 455.18 ms | 80.47 ms |
| ce0a49e | 532.00 ms | 609.96 ms | 77.96 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 23d6b12 | 1.58 MiB | 2.10 MiB | 532.31 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| 1df7eb6 | 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 |
| b750b96 | 1.58 MiB | 2.10 MiB | 533.19 KiB |
| f634d01 | 1.58 MiB | 2.10 MiB | 533.40 KiB |
| 806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| ce0a49e | 1.58 MiB | 2.10 MiB | 532.94 KiB |
#skip-changelog
📜 Description
Useful to test Session Replay, e.g. for this issue: #3560
💡 Motivation and Context
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps