Hi,
I need to lauch app from NFC tag and also pass one more value from tag to app, but I can’t work it out how to get them both working together.
I am using NFC phonegap plugin GitHub - chariotsolutions/phonegap-nfc: PhoneGap NFC Plugin
I have two tags where I have described information:
- mimeType: application/customappname, mimeType: text/plain “hi”
- mimeType: text/customappname, mimeType: text/plain “hi”
Inside the AndroidManifest.xml I have described intent
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/customappname" />
<data android:mimeType="text/customappname" />
</intent-filter>
</activity>
And in deviceready I have mimeType listeners:
nfc.addMimeTypeListener("application/customappname", onNfc, success, failure);
nfc.addMimeTypeListener("text/customappname", onNfc, success, failure);
Workflows
-
scan tag that has mimeType: application/customappname, mimeType: text/plain “hi”
result: application runs, application gets into recent apps history, BUT onNfc from mimeTypeListener is not called and can’t get tag info from launch -
scan tag that has mimeType: text/customappname, mimeType: text/plain “hi”
result: application runs, I can also receive world “Hi”, but app DOES NOT get into recent apps and minifying application losts needed data and app has to be re-launched.
DOES anyone have some idea why first 1) mimeTypeListener is not triggered when I am using mimeType application/*
or why with 2) mimeTypelistener my application doesn’t get to recent apps list?
Thank you for your help.