I have a Service defined in the manifest with an intent filter that
refuses to match when specified as a String resource but works when
the literal action is entered in the manifest. Is there any reason I
should not be able to use a String resource with an action in an
intent filter?
For example:
Manifest Snippet
<service android:name=".subpackage.MyService">
<intent-filter>
<action android:name="com.company.application.subpackage.RUN"></
action>
<!-- This does not work at all, but I expect it to
<action android:name="@string/actionMyServiceRun"></action>
-->
</intent-filter>
</service>
Resource Snippet:
<string
name="actionMyServiceRun">com.company.application.subpackage.RUN</
string>
Code Snippet:
Intent i = new Intent();
// Either of the below lines work
i.setAction(getString(R.string.actionMyServiceRun));
// i.setAction("com.company.application.subpackage.RUN");
i.putExtra(MyService.EXTRA_RUN_CONTINUOUS, b);
startService(i);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en