I am in a train and suddenly thought of something.
If I am allowed to declare my service as below:
<service
android:name=".service.MyService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="INTENT_SAMPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</service>
I know that doing below will result to IllegalArgumentException: Service Intent must be explicit error.
Intent intent = new Intent("INTENT_SAMPLE");
intent.setType("text/plain");
startService(intent);
Then, what is the use of intent-filter in this case, if there is any?
from What is the use of intent-filter in the manifest for a service?
No comments:
Post a Comment