My BroadcastReceiver never gets called when I use "@string/action_name" to define the intent filter action. If I copy/paste the corresponding string from strings.xml into AndroidManifest.xml, then it works perfectly!
Non working example from AndroidManifest.xml:
<receiver
android:name=".ServerUpdateReceiver" >
<intent-filter>
<action android:name="@string/ACTION_INFORM_USER_SERVER_UPDATE" />
</intent-filter>
</receiver>
Working example from AndroidManifest.xml:
<receiver
android:name=".ServerUpdateReceiver" >
<intent-filter>
<action android:name="com.franklinharper.intent.action.ACTION_INFORM_USER_SERVER_UPDATE" />
</intent-filter>
</receiver>
Just for completeness, strings.xml contains the following line:
<string name="ACTION_INFORM_USER_SERVER_UPDATE">com.franklinharper.intent.action.ACTION_INFORM_USER_SERVER_UPDATE</string>
From the spec, there is no way to configure an action with a resource identifier. It has to be a simple string, perhaps to avoid requiring the Android Intent dispatch system to open your APK to figure out what the filter is for.
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