I’ve been using the javax.cardio package to receive an NDEF message from my Nexus S through my ACR122U. I’ve created an Android Beam app that sends a simple text “Hello!” when the intent filters for a NDEF_DISCOVERED tag. When using the TgGetData (0x86) command I seem to get:
NfcP2pLinkManager(7588): Sending ndef via SNEP
NFC JNI(7588): Socket not connected
NFC JNI(7588): LLCP Link deactivated
NFC JNI(7588): LLCP Connect request failed
NfcService(7588): LLCP Link Deactivated message. Restart polling loop.
NFC JNI(7588): phLibNfc_Llcp_Close() returned 0x0001[NFCSTATUS_INVALID_PARAMETER]
NfcP2pLinkManager(7588): Failed to connect over SNEP, trying NPP
NdefPushClient(7588): about to create socket
NfcP2pLinkManager(7588): LLCP deactivated.
NdefPushClient(7588): about to connect to service com.android.npp
NFC JNI(7588): phLibNfc_Llcp_ConnectByUri() returned 0x0011[NFCSTATUS_INVALID_STATE]
NdefPushClient(7588): couldn't send tag
NdefPushClient(7588): exception:
NdefPushClient(7588): java.io.IOException
NdefPushClient(7588): at
com.android.nfc.nxp.NativeLlcpSocket.connectToService(NativeLlcpSocket.java:47)
The APDU workflow I’m following for the ACR122 is basically:
1) TgInitAsTarget = 0xD4, 0x8c
2) TgGetData = 0xD4, 0x86
3) TgSetData = 0xD4, 0x85, 0x81
4) TgGetData = 0xD4, 0x86
Does anyone know why I cannot connect to the “com.android.npp” service on the Nexus S?
I’ve found out why my issue was occurring. I don’t need to send a CONNECT APDU once I recieve the first set of bytes from teh phone via TgGetData. After this first stream of bytes, just send a CC APDU or a CONNECTION COMPLETE. For those who need help, the APDUs should be :
REMEMBER: You must switch the DSAP and SSAP that you get from the phone around to use in your TgSetData. Good luck!