Android receiver for multiple actions?

Viewed 20800

Simple question - Can I register a single BroadcastReceiver to multiple Intent actions? Here's what I'm considering:

<receiver android:name=".myReceiver">
    <intent-filter android:priority="1000000">
        <action android:name="android.intent.action.MEDIA_BUTTON" />
        <action android:name="android.intent.action.ACTION_HEADSET_PLUG" />
    </intent-filter>
</receiver>

So in myReceiver class' onReceive, could I check intent.getAction() for both ACTION_MEDIA_BUTTON and ACTION_HEADSET_PLUG?

4 Answers
Related