Home › Forums › Ask the Flomies › FloBLE+ Android: Send APDU and read response
Tagged: android, APDU, FloBLE Plus
-
AuthorPosts
-
April 26, 2016 at 4:50 pm #55275
Hi, Richard et al,
I’ve got the FloBLE+ demo app working on a Samsung S3 running 4.3. (Probably you should update the demo app project to a lower minimum SDK; currently it requires 21, but 18 is necessary on this handset, and it works.)
What’s the API to send arbitrary APDU commands and read the responses. Sorry if this is a dumb question; I see some UI stuff and the update() method, but there seems to be no way to ask the ReaderManager to transceive a command. I have a set of specific commands I’d like to send:
00A4040007D2760000850101
00A4000C02E103
00B000000F
00A4000C02E104
Even just the first one would be a victory. Thanks again for your help
-Terry
April 28, 2016 at 3:58 pm #55310@Terry, we’re getting the Flomio SDK on Android brushed up for you so that you can send/receive APDUs like we allow for on iOS. This should be completed sometime tomorrow night giving you some time to get your specific commands tested.
Will keep you posted on this thread.
May 2, 2016 at 4:21 am #55371Terry,
We updated the Android SDK so it reads NDEF messages and sends APDUs. Check the Readme.md file for instructions, and if you have questions hit us up here.
Boris
May 2, 2016 at 1:06 pm #55374Thanks, now I’m setting a button to send an APDU:
mTransmitApdu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
readerManager.sendAPDU(“00A4040007D2760000850101”);
}
});But the result code is always: “63 00”
in the notification callback.May 2, 2016 at 1:40 pm #55375Seeing this error with a particular (4K) NFC tag:
05-02 13:37:31.470 23784-23784/com.acs.btdemo E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalArgumentException: string length should be an even number
at com.flomio.android.sdk.Utils.hexString2Bytes(SourceFile:123)
at com.flomio.android.sdk.ReaderManager$14$1.run(SourceFile:589)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)May 2, 2016 at 1:55 pm #55376Success!
I see that the API is automatically retrieving the NDEF, no need for me to send APDU requests
May 2, 2016 at 3:13 pm #55377Still some problems.
It takes some effort to get it to recognize the reader. I have to disconnect, scan, and connect 2-3 times (within the demo app) before it will read a tag.
It can read a standard Type 2 NFC tag, but somewhere inside the SDK it’s concatenating the NDEF rather than replacing, so each time the NDEF comes back appended to the previous buffer.
How would I implement my own low level read, which we’ll need to do in order to read our Type 4 emulated tags? The SdK doesn’t properly read the NDEF record on these tags, though at least it detects them. (Sometimes it does read them but mostly it does not.)
I have a set of about five APDU commands to select the applet and get length of NDEF, then loop to read NDEF in 16-byte chunks. The first one is:
00A4040007D2760000850101 (select tag file system)followed by:
00A4000C02E103 (select applet)and so on.
Can I chain these together and send as a batch, e.g.:
00A4040007D2760000850101\n00A4000C02E103\n1234567890AA\n…Or do I need to send each one and wait for response in callback?
Thanks for your continued assistance.
-TerryMay 2, 2016 at 4:45 pm #55378Hello Terry,
The idea is for you to be able to send APDU commands using the readerManager.sendAPDU method, I’ll check why it’s no working with the NDEF command, I think the issue is that by default every time you scan a card it’s trying to read NDEF and it may be causing conflicts, I’ll disable that and put the NDEF request public to the SDK. I’ll send a fix ASAP.
It’s possible to implement what you want to do (i.e. a single long string) but I think it’s beyond the scope of the Test App so it’ll have to be under a different agreement, if you want I’ll ask around and let you know.
No problem, I’ll try to keep updates coming as fast as I can,
Boris.
May 18, 2016 at 1:40 pm #55504Hi Boris,
Any news on the APDU timing thing? We’d really like to get a successful read. Actually I was able to get a series of successful reads (using your automatic NDEF reading feature) but then it would seem to lock up and stop working.
Thanks,
TerryMay 18, 2016 at 4:50 pm #55505Hey Terry
Almost there. We will have the new version of the SDK soon, we’re currently testing & debugging so we can have it in the next few days.
Boris
May 23, 2016 at 9:01 pm #55539How’s the SDK coming along? Need a beta tester?
-Terry
May 24, 2016 at 1:15 am #55543Hello Terry,
We are almost done, I’m just finishing some details with the code and the documentation since the new version changed significantly. I’ll try to have it today, if not you’ll have it by Wednesday.
Boris.
July 29, 2016 at 9:59 am #56099Hi, I have the same problem…. the problem has been solved?
Thanks -
AuthorPosts
You must be logged in to reply to this topic.