@YourPrivateCoder wrote:
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 https://github.com/chariotsolutions/phonegap-nfc
On first tag I have written 1) application to run 2) text/plain object and on second tag vice versa.
After testing many ways, I understand intent works like OR logic? So if text/json data is first element in tag payload, then it opens app and shows wanted data but it doesn't register auto opened app from tag in recent applications, so if I minify app, I have to lauch it again an it has lost this data.
Second tag opens the app but doesn't receive text/plain on launch but it does register if I touch the tag again while app is open.
<intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="application/io.ionic.starter" /> <data android:mimeType="text/plain" /> </intent-filter>
In order to read second info (text/plain) I register callback:
nfc.addMimeTypeListener("text/plain", onNfc, success, failure);
(If I dont add line
<data android:mimeType="text/plain" />
I can't receive this info at all)Is there a way around how to receive all tag info after lauch is registred in launched apps?
UPDATE:
As I understand only providing<data android:mimeType="text/plain" />
is capable of opening application if tag has only text/plain mimeType and no application info written on tag. So what I want is to open app only if application/... data is written on tag. But I also want to describe additional info on tag and receive it on app launch. But if I don't describe this mimeType on intent, I can't receive this data on launch with nfc.addMimeTypeListener(); But on reading while app already opened, this works.Or can somebody explain why mimeTypelistener like this doesn't work?
nfc.addMimeTypeListener("application/io.ionic.starter", onNfc, success, failure);
Any suggestions?
Thank you for your help.
Posts: 1
Participants: 1