My current intent-filter for my MainActivity looks like this
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
Notice that there are 2 action nodes. Is this correct? Or should there only be one action node per intent-filter?
Also, what is the purpose of the DEFAULT category?
<category android:name="android.intent.category.DEFAULT" />
Is this correct?
It can be, though in this case I suspect it is not what you want.
This <intent-filter>
will match:
an Intent
with the MAIN
action and the LAUNCHER
category, or
an Intent
with the USB_ACCESSORY_ATTACHED
and the LAUNCHER
category
The former is common. However, I rather doubt that USB_ACCESSORY_ATTACHED
will be used with the LAUNCHER
category. I am not even sure it is used with activities, as the documentation is a bit muddled on this point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With