I'm trying to open my application from NFC app chooser dialog which appears when NFC tag is detected by the system. My app appears in chooser dialog.
Case 1:
When application is running in background. On NFC tag detection bring background activity(top activity in task) to foreground.
Problem
I need to specify which activity handles the nfc intent from system in manifest file. So when user selects my application from app chooser system launchs that specified activity. Instead of bring background activity to the front.
Case 2:
When application is not running lunch application with it's launcher activity.
Problem
To achieve this I need to specify launcher screen as NFC intent handler in manifest file. By doing this my app will fail in case 1!
AndoridManifest.xml snippet
<activity android:name=".activityName" ...>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:category="android.intent.category.DEFAULT"
android:resource="@xml/nfc_tech_filter" />
</activity>
What can be the solution to satisfy both cases?
I tried with ActivityManager
but didn't get the solution with it.