6
votes

I'm learning how to use implicit intents along with intent filters, and have so far been unable to get the correct activity to fire. The code that is used to fire the intent is:

intent = new Intent();
intent.setAction("com.appsculture.intent.action.PLUGIN_RECEIVER");
startActivity(intent);

And the Intent filter for the desired activity is:

<activity android:name="PluginReceiver">
<intent-filter>
    <action android:name="com.appsculture.intent.action.PLUGIN_RECEIVER"></action>
</intent-filter>
</activity>

The error I get is the standard ActivityNotFound

09-04 17:15:27.827: ERROR/AndroidRuntime(2552): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.appsculture.intent.action.PLUGIN_RECEIVER }

Solution: Simply addeded the android.intent.category.DEFAULT category to the intent filter

Works like a charm after that

2

2 Answers

4
votes

I managed to solve this by simply adding the android.intent.category.DEFAULT category to the intent filter. Works like a charm after that.

As Commonsware has indicated in a comment on his answer, a category is required for Activities, though not for services or broadcast receivers.

3
votes

Everything you have there should be fine, though I'd use new Intent("com.appsculture.intent.action.PLUGIN_RECEIVER"), and the use of RECEIVER seems like an odd piece of an action name for an Activity instead of a BroadcastReceiver.

If these are in two separate applications, make sure both are installed on your device or emulator, with the latest code (i.e., you didn't make the change and then fail to install the updated app).