×

Discussion Board

Page 2 of 12 FirstFirst 1234567891011 ... LastLast
Results 16 to 30 of 177
  1. #16
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: 6131 NFC autostart on tag touch

    the problem is, which was apparently still nobody here that it makes correct or wants to say us or can?

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

    Re: 6131 NFC autostart on tag touch

    @cde:

    If you want to launch your MIDlet using any empty simpletag, you need the following changes in your code:

    String pushEntry = "nfc:undefined_format";
    String filter = "nfc:rf;type=simpletag;uid=*";

    The connection type value must be "ndef" for NDEF entries and "rf" for Undefined entries.

    With these 2 changes, after you install and run the MIDlet on the phone once, you will be able to launch it again by touching any simpletag that doesn't contain an NDEF record. The Tag Detection should be on on the phone when you want to launch your MIDlet using a tag.

    Please let me know if this works for you and if it answers your question.

    @mariosas:

    I'm not sure I understand what is not working for you. Can you please try to explain in more detail what you are trying to do?
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  3. #18
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: 6131 NFC autostart on tag touch

    Oh. What is that? that is it. Why stands in no documentation?

    String pushEntry = "nfc:undefined_format";
    String filter = "nfc:rf;type=simpletag;uid=*";
    entry in the jad or in code = correct?

    I will test in the next days. Thanks
    Mario

  4. #19
    Registered User
    Join Date
    May 2007
    Posts
    31

    Re: 6131 NFC autostart on tag touch

    @Raluca: Thanks for your answer. I tried your code, but it didn't work.

    What else can I try? Tag detection is off and I use S40_SDK_3rd_Edition_Feature_Pack_1

    regards
    Andi

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

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by cde
    @Raluca: Thanks for your answer. I tried your code, but it didn't work.

    What else can I try? Tag detection is off and I use S40_SDK_3rd_Edition_Feature_Pack_1

    regards
    Andi
    Tag detection should be ON if you want to launch your MIDlet by touching a simpletag. Also, the MiFare Ultralight tag shouldn't have any NDEF records written on it.

    If something is wrong in your code, you should either get an error message in your application when the MIDlet is trying to register the connection or you should get the "Unknown type" error message when you're trying to launch your MIDlet by touching the tag.

    You should also be using the Nokia 6131 NFC SDK 1.0.

    Please let me know if it works after you turn Tag detection on.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  6. #21
    Registered User
    Join Date
    May 2007
    Posts
    31

    Re: 6131 NFC autostart on tag touch

    OK, Tag detection is on now. Now it works! But I had to change the filter string to "*". Any suggestions? I'm using a MF 1k tag.

    Regards
    Andi

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

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by cde
    OK, Tag detection is on now. Now it works! But I had to change the filter string to "*". Any suggestions? I'm using a MF 1k tag.

    Regards
    Andi
    If you want to launch the MIDlet with a MiFare 1k tag, you have to change your filter like this:

    String filter = "nfc:rf;type=mf1k;uid=*";

    The simpletag type will only work with MiFare Ultralight tags.

    Here is a list of all supported target types:
    <target type> ::= "felica" | "jewel" | "simpletag" | "mf1k" | "mf4k" | "iso4a" | "iso4b"
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  8. #23
    Registered User
    Join Date
    May 2007
    Posts
    31

    Re: 6131 NFC autostart on tag touch

    Thank you very much Raluca! It works great!

    regards
    Andi

  9. #24
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: 6131 NFC autostart on tag touch

    Mhm.

    The new Entrys for the .jad file?
    And not in Midlet with PushRegistry.registerConnection(....
    File.jad with
    Midlet Class:
    XXXXX.XXXX
    Connections String:
    ndef:rtd?name=urn:nfc:wkt:RFID_TAG
    Sender IP:
    (=?)

  10. #25
    Registered User
    Join Date
    May 2007
    Posts
    31

    Re: 6131 NFC autostart on tag touch

    I use PushRegistry in the Midlet and don't add an entry in the jad-file.

    String pushEntry = "nfc:undefined_format";
    String filter = "nfc:rf;type=mf1k;uid=*";

    regards
    Andi

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

    Re: 6131 NFC autostart on tag touch

    Quote Originally Posted by mariosas
    Mhm.

    The new Entrys for the .jad file?
    And not in Midlet with PushRegistry.registerConnection(....
    File.jad with
    Midlet Class:
    XXXXX.XXXX
    Connections String:
    ndef:rtd?name=urn:nfc:wkt:RFID_TAG
    Sender IP:
    (=?)
    You can add the PushRegistry entry in the code using PushRegistry.registerConnection or you can add it in the .jad file.

    However, if you add the entry in the .jad file, you still have to add the NDEFRecordListener to your DiscoveryManager instance in the code.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  12. #27
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: 6131 NFC autostart on tag touch

    So.
    The Real Hardware and the Entrys not correct!
    In emulator = no problem.

    Over
    Code:
    // with implements TargetListener
    public void targetDetected(TargetProperties[] properties)  
    {
        TargetType[]  iData = new TargetType[4]; // Types
        Class[] iConnectionName = new Class[properties.length];
        String iMessage = new String();
        for(int i = 0 ; i < properties.length ; i++)
        {         
             iMessage += "TargetTyp:";
             iData = properties[i].getTargetTypes(); 
             for (int i1=0;i1<iData.length;i1++)
             {
                  iMessage += "Nummer "+i1+" ("+iData[i1].toString()+")\n";                // typelist  
              }                        
              iMessage += "getURL(\n"+properties[i].getUrl()+")\n";  // URL from TAG     
              iConnectionName = properties[i].getConnectionNames(); // with Interface 
              iMessage +="ConnectionNames:";
              for (int i2=0;i2<iConnectionName.length;i2++)
              {
                   iMessage += "Nummer "+i2+" ("+iConnetionName[i2].toString()+")\n";
               }
            
    }     
    // iMessage  =
    getUrl
    1.
    for MifareUltraLight
    - nfc:ndef;type=simpletag;uid=*
    = NDEF_TAG & RFID_TAG
    2.
    for Mifare 4k
    - nfc:ndef;type=mf4k;uid=*
    = NDEF_TAG
    3. Filter
    for Mifare 1K
    - nfc:ndef;type=mf1k;uid=*
    = NDEF_TAG

    for Push Registry in .jad file
    MIDlet-Push-1: ndef:rtd?name=urn:nfc:wkt:RFID_TAG,Reader,*
    MIDlet-Push-2: ndef:rtd?name=urn:nfc:wkt:NDEF_TAG,Reader,*
    (=correctly in the hardware)

    if
    Push Entrys = Ok
    THEN
    Where are the filters in the jad entry?
    Or isn't that possible?

  13. #28
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Thumbs up Re: 6131 NFC autostart on tag touch

    check over
    Code:
    boolean registered = false;
    try
    {
           // TAG Typ add Target Listener
         DiscoveryManager.getInstance().addTargetListener(this, TargetType.NDEF_TAG); // NDEF Tag's
         DiscoveryManager.getInstance().addTargetListener(this, TargetType.RFID_TAG); // RFID Tag's
         DiscoveryManager.getInstance().addTargetListener(this, TargetType.ISO14443_CARD); // ISO Cards - hier nicht erforderlich bzw. unterstützt
          // DiscoveryManager.getInstance().addTargetListener(this, TargetType.VISUAL_TAG); // BarCode     = nicht unterstützt              
    //----------------------
           String[] regConns = PushRegistry.listConnections(false);
           // for RFID_TAG and simpletag with Entry
           String pushEntry = "ndef:rtd?name=urn:nfc:wkt:RFID_TAG"; // see old entry in the Thread
           String filter = "nfc:ndef;type=simpletag;uid=*"; // Mifare UL
           // String filter = "nfc:rf;type=simpletag;uid=*";
                
           String message2 = new String("PushRegistry\n");
               
           for (int i = 0; i < regConns.length; i++)
           {
               if (regConns[i].equals(pushEntry))
               {
                    registered = true;
                    message2 += i+" "+ registered;     
                    message2 +="\nfound Push Registry for TAG Typ with ";
                    message2 += regConns[i].toString()+"\n";
                }
                else message2 += i+" not registered\n";     
            }
                
            if (!registered)
            {
                 PushRegistry.registerConnection(pushEntry, System.getProperty("MIDlet-Name"), filter);
                 message2 += "\nnow registered\n";                
            }         
      
            setMsg(message2);    
     }
     catch (Exception e)
     {
     }

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

    Re: 6131 NFC autostart on tag touch

    @mariosas:

    Your PushRegistry entry and your filter both look ok.

    However, you still need to make sure you have the following in your code:

    You need to add an NDEFRecordListener to your DiscoveryManager instance. To do this, your MIDlet class needs to implement NDEFRecordListener (besides TargetListener) and its method recordDetected.

    You can look at the TagTestMidlet example that I mentioned before to see how to do that:

    public class TagTestMidlet extends MIDlet implements CommandListener,
    TargetListener, NDEFRecordListener {
    //...
    public TagTestMidlet() {
    try {
    //Add targets that are listened by the application
    DiscoveryManager dm = DiscoveryManager.getInstance();
    dm.addTargetListener(this, TargetType.NDEF_TAG);
    dm.addTargetListener(this, TargetType.RFID_TAG);
    dm.addNDEFRecordListener(this,
    new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:T"));

    //in your case, this would be: dm.addNDEFRecordListener(this, new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:RFID_TAG"));

    } catch (ContactlessException ce) {
    //...
    } catch (Exception ce) {
    //...
    }
    }

    public void recordDetected(NDEFMessage message) {....}

    }

    Once you have done this, when you install your MIDlet on the phone the registration should work without errors.

    Now, to launch the MIDlet, you only need to have an MiFare Ultralight tag that contains your url - "urn:nfc:wkt:RFID_TAG".

    (If you want to do this in your MIDlet, you have to create an NDEF message with the following NDEF Record type:

    NDEFRecordType myType = new NDEFRecordType NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:RFID_TAG");

    and write the message to an Ultralight tag).

    Please let me know if this works for you.
    Raluca Cindrea
    Helsinki, Finland
    www.nokia.com/nfc

  15. #30
    Registered User
    Join Date
    Oct 2006
    Location
    Berlin
    Posts
    201

    Re: 6131 NFC autostart on tag touch

    Hello Raluca Cindrea.

    Thanks for the detailed assistance.
    Excuse the bad English.

    Basic:
    (Emualtor is not real hardware! Perhaps to 80%.)
    My Midlet works after the start excellently. The PushRegistry is to cause only a starting of the Midlets.
    -start the midlet
    -touch the TAG
    -read the data from TAG (Mifare UL, 1K, 4K)
    -send data to server over http
    = OK

    over code

    - implements TargetListener
    override method
    -public void targetDetected(TargetProperties[] properties)

    The entries in the Push Registry represent the possibility of starting the program with the help of a causer. But not the function of reading the ' TAG ' data.

    From this follows.

    in .JAD -File
    ndef:rtd?name=urn:nfc:wkt:RFID_TAG
    in Code
    DiscoveryManager.getInstance().addTargetListener( this, TargetType.RFID_TAG );

    no entry in code = no read the tag = in the real-hardware -> Unknown service type.

    If the entry would not be correct in the PushRegistry, also the program does not become executable after the installation. Since the installation also with wrong entries is accomplished.

    therefore
    Filter necessarily for 'TAG' not = all TAG's read = no problem = if RFID_TAG
    (Sender IP/Filter = nfc:rf;type=simpletag;uid=* -> Invalid filter thrown java.lang.IllegalArgumentException: Filter invalid java.lang.SecurityException: Application not authorized to access the restricted API)


    For the program it is to be switched on not necessarily those the internal NFC function. Whether you switched off or switched on is, does not play a role.
    Only for the autostart it is important?
    Last edited by mariosas; 2007-06-15 at 08:06.

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
  •  
×