Hi ,
I am trying reading url from tag. When phone touch to tag, it detects tag automatically and read url than launch browser. Is it possible ? I read similar threads in this forum but i am lostI wrote these codes. Can you fix it ? What else i have to add?
Code:public main() { exitCommand = new Command("Exit", Command.EXIT, 1); form = new Form("NFC-Research.at: UID Reader"); form.addCommand(exitCommand); form.append("Touch Tag to read ID."); form.setCommandListener(this); // Registration of the TargetListener for external contactless try { DiscoveryManager dm = DiscoveryManager.getInstance(); dm.addTargetListener(this, TargetType.NDEF_TAG); DiscoveryManager.getInstance().addNDEFRecordListener(this, new NDEFRecordType(NDEFRecordType.NFC_FORUM_RTD, "urn:nfc:wkt:SP")); } catch (ContactlessException ce) { displayAlert("Unable to register TargetListener: " + ce.toString(), AlertType.ERROR); }} 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+" ("+iConnectionName[i2].toString()+")\n"; } } } public void recordDetected(NDEFMessage arg0) { }

I wrote these codes. Can you fix it ? What else i have to add?
Reply With Quote


