@hackbod - It appears this would not work with iOS though. It seems registering a unique scheme is the most cross-platform compatible implementation although I agree with you that it pollutes the namespace... developer.apple.com/library/ios/documentation/iPhone/Conceptual/
@hackbod can you please point me to w3c documentation which suggests to not implement new URI schemes? I have only found rfc2718 which seems to support that.
@hackbod: Like Casebash, I am having problems with your instructions. Given an activity, I dump getIntent().toUri(Intent.URI_INTENT_SCHEME).toString(), paste that in a Web page (commonsware.com/sample), try opening it in a browser on the emulator, and I get choices of opening the page in Browser, Contacts, or Phone, but not my activity. That seems strange, considering that the intent: URI from toUri() has the component clause, so I'm not sure how those other apps can get it. I have the BROWSABLE category on the intent filter. If you have any thoughts, please @ me back. Thanks!
Android defines a Uri syntax for describing a generic Intent. There are methods on Intent for converting to and from this representation, such as: http://developer.android.com/reference/android/content/Intent.html#toUri(int)
At first I thought that you didn't explain how ignoring the standard rules for URIs is bad, but then I found your other answer here.
Don't bother trying this method if you want your URIs to reliably work; using intent URIs requires cooperation from the app taking the URI. zxing (Barcode Scanner) doesn't accept them (by deliberate design decision, apparently), so if you want to be able to scan barcodes to talk to your app (or take URI input from any other method you don't completely control), you either need to overload http:// (which requires a user choice between browser and your app) or just go with a custom scheme, which as far as I can tell passes transparently into the system and doesn't get caught up anywhere).
In summary: read the regular documentation on intents and intent filters (such as the NotePad tutorial, though you won't be using content: URIs here, probably just custom actions) and get your app working that way. Then you can make a browser link to launch your app in the same way, provided your intent-filter handles the BROWSABLE category.
So the way to do this is to use the normal facilities to describe an in your manifest for the kinds of intents you are going to handle with a particular component, especially defining an action name in your own namespace (com.mycompany.myapp.action.DO_SOMETHING or whatever). You can then make an Intent that matches your component, and use Intent.toUri() to get the URI representation of this. This can be placed in your link, and will then when pressed look for something that handles and and thus find your app. Note to be launched from the browser like this, the component's must handle the BROWSABLE category. (You don't need to have this in the Intent you put in the link, the browser will automatically add this in for you.)
This is a newer feature in the platform, which allows you to direct link intents to only your app so that other applications can not intercept and handle them.
You need to follow the standard rules for URIs via the W3C and such, which basically means: do not do this.