Autostart application and reading tag UID with one touch
Is there any possibility to autostart my application, read out the NDEF records and the tag UID with just one touch to the tag?
If I touch the tag the registered application is started and the application as NDEFRecordListener is called with recordDetected(...). With this call I get the NDEF records content. But how can I get the tag UID?
Even If I implement TargetListener.targetDetected(...) this method will only be called, if I touch the tag for a second time and the application is already running.
Does anyone have any suggestions to solve this problem?
Re: Autostart application and reading tag UID with one touch
You can only get the NDEF records content with one touch of the tag (the one that launches the application). If you need other target specific information, like the tag UID, you have to touch the tag again.
However, PushRegistry connection filters can be used to define which type of tags can trigger a MIDlet to be launched and you might find this useful, depending on your needs.
The filter syntax for NDEF PushRegistry is:
<filter> ::= "*" | "nfc:"<conn type>";type="<target type>";uid="<uid>
You could set filters so that the MIDlet is launched only if a tag with a certain UID is detected. For example, if you want to touch a SimpleTag that has the UID 0x11223344556677 in order to launch the MIDlet, you can use the following line:
PushRegistry.registerConnection("ndef:mime?name=text/plain",
"test.TestMIDlet", "nfc:ndef;type=simpletag;uid=11223344556677");
I hope this helps.
Re: Autostart application and reading tag UID with one touch
Thanks. Yes, it works now.
__
[url]http://djcall.com[/url]
Re: Autostart application and reading tag UID with one touch
Hi,
I wonder if i've 4 card with 4tag UID(ex 1 2 3 4), how could i start MIDletA with 123 and MIDletB with 4? I mean how can i pushregistry with differences UIDs at the same type of card, so what is the syntax for?
Thank you,
Minh
Re: Autostart application and reading tag UID with one touch
Hello,
I want to write a midlet that will triggered only one touch a tag and autostart. The difficulty is to read data from tag on the first touch. On nokia 6131 nfc phone, there is an application that outo detects business cards. Like that i want to launch my application and read tag simultaneously.
Re: Autostart application and reading tag UID with one touch
Hi,
As Raluca said, only NDEF message can be read when midlet is started using push registry. For other types of tags another touch is needed.
NDEF message can be get using NDEFRecordListener. See example,
[url]http://wiki.forum.nokia.com/index.php/NFC_PushRegistry_launch_and_detect_example[/url]
Re: Autostart application and reading tag UID with one touch
[QUOTE=samuuh;374981]Hi,
As Raluca said, only NDEF message can be read when midlet is started using push registry. For other types of tags another touch is needed.
NDEF message can be get using NDEFRecordListener. See example,
[url]http://wiki.forum.nokia.com/index.php/NFC_PushRegistry_launch_and_detect_example[/url][/QUOTE]
I notice that when PushRegistry is used to start MIDlet on any tag and targetDetected() is called, that the tag UID is in the URL returned by:
TargetProperties target = detectedTarget[0];
String url = target.getUrl();
I wondered if in the auto-start from NDEF message case, if it is not possible in recordDetected() to get the URL from the NDEf message, and hence get the URL?
Just an idea.