android - What does "category" in the manifest mean? -
the documentation says can specify custom category.
- when, why , how it?
- what use of it?
the way understand it, categories public directives android operating system(and other apps) represent different categories app should part of.
example
- when launcher icon tapped on home screen, home application looks through every installed app's manifest
home
category -- , if displays in app drawer.
however, there's more. can specify categories in applications manifest lets system know application can handle intent category. example, putting alternative
category, other apps in system know app can handle category without knowing action name! in following example, custom intent categories passed through intent, filtered , corresponding object gets edited(taken notes example app):
<intent-filter android:label="@string/resolve_title"> <action android:name="com.android.notepad.action.edit_title" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.alternative" /> <category android:name="android.intent.category.selected_alternative" /> <data android:mimetype="vnd.android.cursor.item/vnd.google.note" /> </intent-filter>
by registering intent filter in <activity />
tag, can edit "note". intent data contain note, , intent routed activity filter registered in.
in conclusion:
there isn't reason you'd use custom category. android, , don't make sense in application use. but, if choose use them, can used in methods described above. "they provide specific semantic rules, , if rules useful feel free use them"(hackbod).
Comments
Post a Comment