×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    130

    TargetListener and NDEFRecordListener

    In my MIDlet I register 2 listeners TargetListener and NDEFRecordListener with one I am trying to receive ndef message and with another tag UID during autostart.

    So it's should be so with one touch MIDlet started, ndef message and tag uid is received by those listeners.

    But I got a problem: I received ndefmessage but targetDetected(TargetProperties[] tProp) method which should set tagUID is not called.

    At Emulator everything works fine and in real device not.

    What could be a solution?

    Code something like that:
    ---------------------------------------
    String tagUID = null;
    public void targetDetected(TargetProperties[] tProp) {

    tagUID = tProp[0].getUid();


    }

    public void recordDetected(NDEFMessage message) {

    do {} while (tagUID()== null);
    doStuff(message,tagUID );

    }
    ------------------------------------------------------
    Last edited by Alex_Polt; 2007-08-09 at 13:42. Reason: update

  2. #2
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Helsinki, Finland
    Posts
    91

    Re: TargetListener and NDEFRecordListener

    Quote Originally Posted by Alex_Polt View Post
    In my MIDlet I register 2 listeners TargetListener and NDEFRecordListener with one I am trying to receive ndef message and with another tag UID during autostart.

    So it's should be so with one touch MIDlet started, ndef message and tag uid is received by those listeners.

    But I got a problem: I received ndefmessage but targetDetected(TargetProperties[] tProp) method which should set tagUID is not called.
    If a MIDlet is launched by touching a NDEF tag and a NDEFRecordListener is registered to DiscoveryManager using the appropriate NDEF record type within thirty seconds of getting the DiscoveryManager instance, then the listener will be notified. The recordDetected() parameter will contain the NDEF record that triggered the launch. When a secure element push registration causes a MIDlet to be launched then similarly a TransactionListener will be notified.

    The MIDlet can see that it was launched by touching a tag by reading the DiscoveryManager property LaunchType. However, to get more information about the tag, i.e. a TargetListener call and read the UID, the tag must be touched again.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

Posting Permissions

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