Reputation: 71
I was going over some of the Android resources and found something interesting. It says to add intent filters with the different data, category, and actions capable of the Activity to the Android manifest. However i've been able to get my app working without adding those things. Can any one explain if it is required and what adding those intent filters actually does?
Upvotes: 0
Views: 87
Reputation: 537
It's required that you have one Activity with the following intent-filter
IF you want your application to show up on the launcher:
<activity android:name=".YourMainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This let's the OS know which Activity to show when your application is started. NOTE: You don't need the above intent-filter
if you don't want your application to show up on the launcher (if your application is a widget, for example) (Thanks to Justin Breitfeller).
If you'd like more information on Intent-Filters, check out the developer docs. A common use is allowing other applications to call your application if it can handle certain operations (such as sending an email, launching the camera, etc). If you declare these operations in your AndroidManifest
, then your application can be called via Implicit Intent
s (see the above link).
Upvotes: 2