Hacker News new | ask | show | jobs
by trezor 5425 days ago
IMO it works really well and is one of the things which sets Android apart from iOS and other OSes in general.

One of the finer points which I really appreciate is how intents can be fine-tuned not only to handle "a image" or "a mp3" or act like a extension/protocol-handler in your desktop OS, but how it can react on parts of a intent, like the domain of a URL.

When someone links to Applications on Android market on a web-page (i.e., a https-link to market.android.com) and I click it on my Android device, I actually get the link "opened" by having Android market app launched and focused on that specific application. Very, very neat.

The same thing can be done for wikipedia readers. A wikipedia link launches your app. In the same way other apps can provide intents for music selection, playback, data-sources, data-consumers and god knows what. Or just have an app become the default for some action on your system by handling the generic intent (i.e. surf the web).

Intents are one of the really good things which makes Android Android. And in case there were any doubts: I think it works out bloody fantastic.

1 comments

You've highlighted a subtle but important point of the Intent design. Unlike traditional file-handlers, you can say "I might handle this kind of thing" and then watch what flies by and only respond to what you actually care about (e.g. the market only responding to URLs pointing to the Android market). That makes Intents more powerful and more precise than previous approaches to similar problems.
Is there any security hole in this? Can an app register an intent on http and get access to all URLs Browser loads?
Actually, they can. Android browsers register to handle such requests. That's how users can switch between default browsers. Additionally, that's how the YouTube app can register to watch YouTube links. I click on a post on reddit, it links to a youtube video and it pops up and asks if I want to open it with the browser, (Dolphin, xScope) or YouTube.