ASOS Sep 6, 2023

A Rundown of Android Intent Selectors: Building Intents Correctly

Article Summary

Jack Webb from ASOS discovered a common Android Intent mistake that could trap users in infinite loops. Most developers use ACTION_VIEW to open URLs, but there's a critical flaw hiding in plain sight.

When building a fallback to open ASOS's website in a browser, Webb hit a bizarre bug: the intent kept opening the ASOS app instead, creating an endless loop. The culprit? ACTION_VIEW is too generic and doesn't distinguish between browsers and apps with deep links. The solution involves a lesser-known Android feature: Intent Selectors.

Key Takeaways

Critical Insight

Using Intent Selectors with CATEGORY_BROWSABLE and an empty http: scheme ensures links always open in actual browsers, not apps with deep link handlers.

The article reveals how this same selector technique applies beyond browsers to phone dialers, VOIP apps, and share targets.

Recent from ASOS

Related Articles