Seek-for-android. Connection refused ! Android -
i'm using library seek-for-android develop same application.
when try run test app hellosmartcard https://code.google.com/p/seek-for-android/wiki/usingsmartcardapi take error: "connection refused !!!"
i'm using samsung s iii , following code:
public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linearlayout layout = new linearlayout(this); layout.setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); button = new button(this); button.setlayoutparams(new layoutparams( layoutparams.wrap_content, layoutparams.wrap_content)); button.settext("click me"); button.setenabled(false); button.setonclicklistener(new onclicklistener() { public void onclick(view v) { try { log.i(log_tag, "retrieve available readers..."); reader[] readers = seservice.getreaders(); if (readers.length < 1) return; byte aid[] = new byte[] {(byte)0xa0, 0x00,0x00,0x00,0x03,0x20,0x10}; secardidentifier id = new secardidentifier(aid); log.i(log_tag, "create session first reader..."); session session = readers[0].opensession(); log.i(log_tag, string.valueof(session.getreader().getname())+" "+id.getaid().tostring()); log.i(log_tag, "create logical channel within session..."); channel channel = session.openlogicalchannel(aid); log.i(log_tag, "send helloworld apdu command"); byte[] respapdu = channel.transmit(new byte[] { (byte) 0x90, 0x10, 0x00, 0x00, 0x00 }); channel.close(); // parse response apdu , show text remove sw1 sw2 first byte[] hellostr = new byte[respapdu.length - 2]; system.arraycopy(respapdu, 0, hellostr, 0, respapdu.length - 2); toast.maketext(mainactivity.this, new string(hellostr), toast.length_long).show(); } catch (exception e) { log.e(log_tag, "error occured:", e); return; } } }); layout.addview(button); setcontentview(layout); try { log.i(log_tag, "creating seservice object"); seservice = new seservice(this, this); } catch (securityexception e) { log.e(log_tag, "binding not allowed, uses-permission org.simalliance.openmobileapi.smartcard?"); } catch (exception e) { log.e(log_tag, "exception: " + e.getmessage()); } } @override protected void ondestroy() { if (seservice != null && seservice.isconnected()) { seservice.shutdown(); } super.ondestroy(); } public void serviceconnected(seservice service) { log.i(log_tag, "seviceconnected()"); button.setenabled(true); }
and return next exception :
05-13 11:23:09.979: i/hellosmartcard(17588): creating seservice object 05-13 11:23:09.984: v/seservice(17588): bindservice successful 05-13 11:23:10.054: i/hellosmartcard(17588): seviceconnected() 05-13 11:23:10.054: v/seservice(17588): service onserviceconnected 05-13 11:23:11.444: i/hellosmartcard(17588): retrieve available readers... 05-13 11:23:11.444: i/hellosmartcard(17588): create session first reader... 05-13 11:23:11.444: i/hellosmartcard(17588): sim: uicc a0000000032010 05-13 11:23:11.444: i/hellosmartcard(17588): create logical channel within session... 05-13 11:23:11.634: e/hellosmartcard(17588): error occured: 05-13 11:23:11.634: e/hellosmartcard(17588): java.lang.securityexception: connection refused !!! 05-13 11:23:11.634: e/hellosmartcard(17588): @ org.simalliance.openmobileapi.seservice.checkforexception(seservice.java:553) 05-13 11:23:11.634: e/hellosmartcard(17588): @ org.simalliance.openmobileapi.seservice.openlogicalchannel(seservice.java:365) 05-13 11:23:11.634: e/hellosmartcard(17588): @ org.simalliance.openmobileapi.session.openlogicalchannel(session.java:131) 05-13 11:23:11.634: e/hellosmartcard(17588): @ com.example.com.pentegy.nfctest.mainactivity$1.onclick(mainactivity.java:65) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.view.view.performclick(view.java:4211) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.view.view$performclick.run(view.java:17267) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.os.handler.handlecallback(handler.java:615) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.os.handler.dispatchmessage(handler.java:92) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.os.looper.loop(looper.java:137) 05-13 11:23:11.634: e/hellosmartcard(17588): @ android.app.activitythread.main(activitythread.java:4898) 05-13 11:23:11.634: e/hellosmartcard(17588): @ java.lang.reflect.method.invokenative(native method) 05-13 11:23:11.634: e/hellosmartcard(17588): @ java.lang.reflect.method.invoke(method.java:511) 05-13 11:23:11.634: e/hellosmartcard(17588): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1006) 05-13 11:23:11.634: e/hellosmartcard(17588): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:773) 05-13 11:23:11.634: e/hellosmartcard(17588): @ dalvik.system.nativestart.main(native method)
please me solve problem.
i came across same situation, while in situation sesevice.getreader()
throws exception "connection refused". that's say, can't 1 reader.
i read the following info google, hope explain situation.
samsung did include uiccterminal.java sim access , removed result valid , recommended way integrate scapi products.
could please tell rom test running on, can switch same rom , sim card reader?
Comments
Post a Comment