Hacker News new | ask | show | jobs
by rogerbinns 4819 days ago
What exactly is wrong with using Intents in Android? They would seem to be a far better mechanism for Android code, and also interoperate with the rest of the system (eg notifications).
3 comments

The idea here is you can still use them, this just provides a higher level protocol/interface or standard that works across both, I love clean urls and context so I love this. Smart components, overarching director/handler/navigator, basically the web and game component architecture.

If you are making cross platform apps you have something like this but taking from web frameworks routing within apps is the best way to do this if you run from web, app, desktop and need a common system which the platforms then use system specific libs after.

The worst thing you can do making cross platform apps and games fast is to fall too in love with a great feature of one platform when you can standardize non essential stuff like this and simplify (i.e if you want server synced profiles using a cross platform solution over iCloud for instance, but maybe iCloud is an additional sync from your system on iOS but not the base). Then really beef up the areas where you do need to use system lock-in features for performance or familiarity.

Nothing's necessarily wrong with them; but if you want to dynamically change the action of say a button from your server, then URL routing gives you a single string-based mechanism vs. writing some serpentine Intent creation logic in that method.
This is really useful to hook into URLs matching a certain scheme when using an IntentFilter on an activity. If you know that emails or web-oriented content may be on the users device you can simply have the filter listen for the android.intent.action.VIEW action and set the pattern for the URL you expect. Having a class or couple of classes to parse that URL and route the user to the right app activity via Intents can be really helpful for more complex URLs.