the problem is, which was apparently still nobody here that it makes correct or wants to say us or can?
the problem is, which was apparently still nobody here that it makes correct or wants to say us or can?
@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
Oh. What is that? that is it. Why stands in no documentation?
entry in the jad or in code = correct?String pushEntry = "nfc:undefined_format";
String filter = "nfc:rf;type=simpletag;uid=*";
I will test in the next days. Thanks
Mario
@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.Originally Posted by cde
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
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:Originally Posted by cde
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
Thank you very much Raluca! It works great!![]()
regards
Andi
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:
(=?)
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
You can add the PushRegistry entry in the code using PushRegistry.registerConnection or you can add it in the .jad file.Originally Posted by mariosas
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
So.
The Real Hardware and the Entrys not correct!
In emulator = no problem.
Over
getUrlCode:// 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 =
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?
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) { }
@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
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.