I have a broadcast receiver with an intent filter that specifies a single custom category:
<receiver
android:name=".sys.sub.SubServiceManager"
android:enabled="true"
android:exported="false" >
<intent-filter>
<category android:name="com.example.SUB_SERVICE_STATE" />
</intent-filter>
</receiver>
Then there is this code that issues a broadcast using that intent category with custom actions. My problem is the broadcast is never received.
Intent speed = new Intent();
speed.addCategory(inst.getString(R.string.subServiceCat));
speed.setAction("com.example." + SubServiceManager.START_COMMAND + Example.NAME);
inst.sendBroadcast(speed);
R.string.subServiceCat holds the same string as defined in the intent-filter.
Is there something else I have to do for a custom-category intent filter?
Documentation says:
You see that your filter does not specify an action,so your intent can not get through the filter.To solve this problem you would to specify an action to your receiver’s filter or do not specify any action to your intent.