sherod (1) [Avatar] Offline
#1
I'm reading chapter 2 and its talking a lot about intent's and categories.

"We saw an example of declaring an IntentFilter in the application manifest of DealDroid in listing 2.1. Recall that filter had an action of MAIN and a category of LAUNCHER. This declares that our DealList Activity should be made available on the Home screen (the platform Launcher application). "

My comment here is... how? Is LAUNCHER the category you use that will cause android to place it on the home screen? Is main the entry point? Are any other values valid?

What actually is the role of an intent category? Can I make my own up? When are they useful? It's not clear to me. smilie
mgalpin (2) [Avatar] Offline
#2
Re: Intent Categories
You can think of categories as just extra metadata that can be used to filter/distinguish. So yes you can make them up.

Here's another example. When you use push notifications, you have to get a registration ID from Google, it is like a routing number (user+device+app). You get this from an Intent that is broadcast with a specific action. However you don't want any app to be able to receive this Intent, so a category is added to it. Then you can create a receiver that uses an IntentFilter with this custom category (the package of your application) so that only your application receives this valuable bit of data.