I'm writing an application that makes use od NFC tags. I want NFC tag to be an entry point to my application - closing card containing tag up to the telephone should start my activity. Then, when activity is running, I want to disable all intent filters that can make use of NFC tag, so the another close up would do nothing (I don't want my activity to start all over again). I know how to "disable" my intent filter, using activity aliases:
<activity-alias android:enabled="true"
android:name=".alias.NFCEntryPoint"
android:targetActivity="pl.mitrue.safedb.NFCEntryPoint"
android:exported="true"
android:icon="@drawable/ic_launcher"
android:label="@string/alias.pl.mitrue.safedb.NFCEntryPoint" >
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
Then I can programatically disable alias, so my intent filter is disabled too:
getPackageManager().setComponentEnabledSetting(new ComponentName("pl.mitrue.safedb", "pl.mitrue.safedb.alias.NFCEntryPoint"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Now here's the problem: I have other applications that use that kind of filter installed on my device. Now, when my application is running and I disabled my intent filter (by disabling activity alias), a dialog appears asking me to choose an application to use. Is there any way to avoid this? In the simplest scenario, once my application is started I don't want to take up any action when closing up NFC tag. Is there any way to make my application the only one that can receive external intents?
For the record: I don't want to turn off NFC completely (I don't know if it is even possible), since I may want to make use of it in other activity later.
I hope I've made my point clear. Please be understanding since I am new here.
Thanks!