×

Discussion Board

Page 12 of 12 FirstFirst ... 23456789101112
Results 166 to 177 of 177
  1. #166
    Registered User
    Join Date
    Feb 2006
    Posts
    22

    Re: 6131 NFC autostart on tag touch

    Dear all,
    I am trying to make my application start upon tags touches.
    I am using a 6212 and as tags the ones that come into the boc. I do not know which types are they

    In the following there is the code I use for initialize the NFC and the push registry.
    The application gets intalled and asks me for permission to autostart.
    However, if I try to touch the tag when the application is not running, the app won't start, but the phone will read the tag as a note.

    The tag simply contains a string "hello".

    Code:
    void initNFC()
    {
                dm = DiscoveryManager.getInstance();
                try {
                    dm.addTargetListener(this, TargetType.NDEF_TAG);
                    dm.addNDEFRecordListener(this, new NDEFRecordType(
                            NDEFRecordType.MIME, "Text/Plain"));
                   PushRegistry.registerConnection("ndef:mime?name=Text/Plain",this.getClass().getName(), "*");
                    
                } catch (Exception e) {
                    form.append("EX: "+e.toString());
                    form.addCommand(exitCommand);
                    form.setCommandListener(this);
                    d.setCurrent(form);
                }
    }
    Any idea?

  2. #167
    Registered User
    Join Date
    Oct 2006
    Posts
    182

    Re: 6131 NFC autostart on tag touch

    Hi,

    you need to create a tag with mime format as text/plain, since you are registering a push for that mime format.

    please try with a static push entry in your application JAD file also. like "MIDlet-Push-1: ndef:mime?name=text/plain, com.yourcomp.yourmidlet, *"

    regards
    sunil

  3. #168
    Registered User
    Join Date
    Nov 2009
    Posts
    23

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by geri-m View Post
    As far as I'm concerend the Emulator does not support the Auto-Launch/PushReg feature on tag-touch, as it also does not support OTA deploying. (Please let me know if I'm wrong ...)

    Cheers, Gerald
    I have got the emulator to work with push registry starting of an application.
    I am using the 6212 Classic NFC emulator.

    You have to set it to do "OTA" installation (Tools->Preferences->MIDP tab), so it goes through the Application Management System and is verified by JAM and INSTALLS the MIDlet in the emulator (i.e. stores it in the PC file system).

    NOTE: I am still unable to get static push registry to work comletely on emulator nor handset (6212) but that is a different story. I have to start the app and have it programmatically register itself.

    Then if you exit the MIDlet and go back to emulator's normal menu. If you attach a tag using the NFC manager your application will be started.

    NOTE: I cannot get the recordDetected() method to be called on this auto-start, that's another issue I'm working on.

  4. #169
    Registered User
    Join Date
    Nov 2009
    Posts
    23

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by giaperrucci View Post
    Dear all,
    I am trying to make my application start upon tags touches.
    I am using a 6212 and as tags the ones that come into the boc. I do not know which types are they

    In the following there is the code I use for initialize the NFC and the push registry.
    The application gets intalled and asks me for permission to autostart.
    However, if I try to touch the tag when the application is not running, the app won't start, but the phone will read the tag as a note.

    The tag simply contains a string "hello".

    Code:
    void initNFC()
    {
                dm = DiscoveryManager.getInstance();
                try {
                    dm.addTargetListener(this, TargetType.NDEF_TAG);
                    dm.addNDEFRecordListener(this, new NDEFRecordType(
                            NDEFRecordType.MIME, "Text/Plain"));
                   PushRegistry.registerConnection("ndef:mime?name=Text/Plain",this.getClass().getName(), "*");
                    
                } catch (Exception e) {
                    form.append("EX: "+e.toString());
                    form.addCommand(exitCommand);
                    form.setCommandListener(this);
                    d.setCurrent(form);
                }
    }
    Any idea?
    The tag with "Hello" is probably not a MIME type with "Text/Plain" but a tag with an NFC define "Text" RTD type.

    So, your recordType you should register for would be NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:T" where the "T" is for the Text RTD defined by NFC Forum.

  5. #170
    Registered User
    Join Date
    Feb 2009
    Posts
    17

    Re: 6131 NFC autostart on tag touch

    Hi everyone and thanks for your very helpful post!

    I'm trying also to start the Midlet with my Tag, but I don't understand how to format a Tag in MIME format and which data corresponding to my Midlet I have to write in it...

    Here's my code for writing my tag :

    String url = detectedTarget[i].getUrl(Class.forName("javax.microedition.contactless.ndef.NDEFTagConnection"));

    conn = (NDEFTagConnection) Connector.open(url);
    NDEFRecordType myType = new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD,"urn:nfc:wkt:T");
    NDEFRecord myRec;

    myRec = new NDEFRecord(myType, null, data);
    NDEFRecord[] myRecArray = new NDEFRecord[] {myRec };
    NDEFMessage myMessage = new NDEFMessage(myRecArray);
    conn.writeNDEF(myMessage);

    But when I did so it doesn't launch my midlet but save a note with the byteArray data passed in myRec...

    Could someone explain this MIME format thing? Thanks a lot

    Antoine

  6. #171
    Registered User
    Join Date
    Sep 2007
    Posts
    40

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by Raluca_ View Post
    Yes, this is possible. Please see the following thread for information on how to do this:

    http://discussion.forum.nokia.com/fo...d.php?t=105707

    Please let me know if you need more details.
    Hello Raluca, I wanted to have something clear: Once my registered push application detects a matching target and NDEFRecord, will these NDEFRecord's get read immediately to display in a form? or should I touch the card again?

  7. #172
    Registered User
    Join Date
    Sep 2007
    Posts
    40

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by ant.pitel View Post
    Hi everyone and thanks for your very helpful post!

    I'm trying also to start the Midlet with my Tag, but I don't understand how to format a Tag in MIME format and which data corresponding to my Midlet I have to write in it...

    Here's my code for writing my tag :

    String url = detectedTarget[i].getUrl(Class.forName("javax.microedition.contactless.ndef.NDEFTagConnection"));

    conn = (NDEFTagConnection) Connector.open(url);
    NDEFRecordType myType = new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD,"urn:nfc:wkt:T");
    NDEFRecord myRec;

    myRec = new NDEFRecord(myType, null, data);
    NDEFRecord[] myRecArray = new NDEFRecord[] {myRec };
    NDEFMessage myMessage = new NDEFMessage(myRecArray);
    conn.writeNDEF(myMessage);

    But when I did so it doesn't launch my midlet but save a note with the byteArray data passed in myRec...

    Could someone explain this MIME format thing? Thanks a lot

    Antoine
    Hi Ant, do you know if once my registered push application detects a matching target and NDEFRecord, will these NDEFRecord's get read immediately to display in a form? or should I touch the card again?

  8. #173
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: 6131 NFC autostart on tag touch

    Hallo,

    Quote Originally Posted by juancarlosr View Post
    Do you know if once my registered push application detects a matching target and NDEFRecord, will these NDEFRecord's get read immediately to display in a form? or should I touch the card again?
    Yes, these records are read on the first touch. Upon start your "NDEF pushed" application should immediately register an NDEFRecordListener for the record type that triggered the PushRegistry. Then the recordDetected(NDEFMessage) callback will receive the NDEFMessage that caused the application start.

    br,
    Michael

  9. #174
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: 6131 NFC autostart on tag touch

    Hallo ant.pitel,

    Quote Originally Posted by ant.pitel View Post
    I'm trying also to start the Midlet with my Tag, but I don't understand how to format a Tag in MIME format and which data corresponding to my Midlet I have to write in it...

    Here's my code for writing my tag :
    [...]
    NDEFRecordType myType = new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD,"urn:nfc:wkt:T");
    NDEFRecord myRec;

    myRec = new NDEFRecord(myType, null, data);
    NDEFRecord[] myRecArray = new NDEFRecord[] {myRec };
    NDEFMessage myMessage = new NDEFMessage(myRecArray);
    conn.writeNDEF(myMessage);
    The NFC Forum Well-known type urn:nfc:wkt:T (Text Record) and the MIME type text/plain are two different things. Therefore, you can either base your application on the Text record or on the text/plain MIME type.

    For the Forum type Text Record, your PushRegistry entry would look something like this:
    Code:
    MIDlet-Push-1: ndef:rtd?name=urn:nfc:wkt:T,your.MIDlet,*
    You can then register an NDEFRecordListener for this NDEF record type in your application:
    Code:
    dm.addNDEFRecordListener(this, new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:T");
    This should work for the NDEF message that you create with your code.


    For the MIME type text/plain, your PushRegistry entry would look something like this:
    Code:
    MIDlet-Push-1: ndef:mime?name=text/plain,your.MIDlet,*
    You can then register an NDEFRecordListener for this NDEF record type in your application:
    Code:
    dm.addNDEFRecordListener(this, new NDEFRecordType(NDEFRecordType.MIME, "text/plain");

    br,
    Michael

  10. #175
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Re: 6131 NFC autostart on tag touch

    Hi, I've been able to realize autolaunch by static registration in the Jad file.
    I know that for autolaunching and reading the data of the ndef formatted tag, I need to implements NdefRecordListener interface.
    according to the javadoc using NdefRecordListener is not possible to access the tag in write mode.

    The application i'm developing need to:
    1. autostart on tag touch
    2. read data from the tag
    3. do some computation on this data
    4. write the updated data back to the tag
    It shoul be done in just one interaction.

    Right now i've done it simply implementig TargetListener, but in this way I need to touch the tag twice, is there a way to do everithyng in one touch.

    Thanks and sorry for my bad english

  11. #176
    Registered User
    Join Date
    Feb 2009
    Location
    Hagenberg, Austria
    Posts
    121

    Re: 6131 NFC autostart on tag touch

    Hallo Simon,

    Quote Originally Posted by Simon-Italy View Post
    according to the javadoc using NdefRecordListener is not possible to access the tag in write mode.
    Right, the NDEFRecordListener allows for the phone implementation to receive & buffer the NDEF records. Thus, the NDEF message can be passed to an application even if the tag is no longer present.

    Quote Originally Posted by Simon-Italy View Post
    Right now i've done it simply implementig TargetListener, but in this way I need to touch the tag twice, is there a way to do everithyng in one touch.
    Sorry, but there is none. The reason for this is that touching a tag is meant to be a short operation. With the NDEFRecordListener it is not required that the tag is still present when the application reads the NDEF records. Therefore, no write operations can be allowed by the time the application processed the NDEF records.

    br,
    Michael

  12. #177
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Re: 6131 NFC autostart on tag touch

    Thanks Michael for your clear answer.

Similar Threads

  1. Autostart application and reading tag UID with one touch
    By choege in forum Near Field Communication
    Replies: 6
    Last Post: 2010-02-22, 12:38
  2. Communication between 2 Nokia 6131 NFC
    By zhs_bravo in forum Near Field Communication
    Replies: 13
    Last Post: 2009-01-05, 10:23
  3. TargetListener Problems in nokia 6131 NFC
    By JesusFD in forum Near Field Communication
    Replies: 3
    Last Post: 2008-03-31, 11:52
  4. Nokia 6131 NFC SDK 1.0 has been released
    By Nokia Ron in forum Near Field Communication
    Replies: 0
    Last Post: 2007-03-26, 22:28
  5. Can't read RFID Tag with NFC Shell
    By begermic in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-01-31, 23:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •