2

Android Device: Unlocked Rooted Samsung Galaxy Nexus

USB NFC Readers: ACR122, ACR122L


I am attempting to create a proof-of-concept for an upcoming project. Unfortunately, I cannot go into extreme detail about the project, but I think I can explain what I am trying to do adequately to get some help.

I need to use the NFC reader (either one) connected to a Linux (CentOS 6) workstation. When I 'scan' the phone, I need it to send me a message, and put that message into STDOUT.

Basically, if I have nano open, and scan the phone, it should put that message into nano.

Does this mean I have to create an Android app to push messages using ForegroundNdefPush? If so, is there any way to retrieve some kind of unique value from the phone, e.g. the IMEI or serial number?

It doesn't have to be a customized message, but I need a unique ID for every device I scan.

The ideal answer will not require anything but development using the ACR122 SDK. If a special app for the phone is required, it may kill my proof-of-concept before I actually prove any concept.

mistiry
  • 165
  • 2
  • 9

2 Answers2

1

Does this mean I have to create an Android app to push messages using ForegroundNdefPush?

If by "scan the phone" you are expecting the Android device to behave as though it is an NFC tag, then you will certainly have to do something, and I'm reasonably certain that something will involve ForegroundNdefPush. Your Android phone is not sitting around all the time with the NFC radio powered up, pretending to be a tag. Partly, that's for battery life.

If so, is there any way to retrieve some kind of unique value from the phone, e.g. the IMEI or serial number?

Here is Google's official opinion on the matter. Since you are targeting NFC devices, ANDROID_ID will be reasonably reliable, outside of rooted phones and (possibly) modded ROMs.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • That was my guess, about the NDEF push. I am just now learning about NFC protocols, in my 'spare time' (i.e. while doing a bunch of other unrelated tasks). Trouble with all of this, is I need it to work on Androids as well as iPhones, so I don't think ANDROID_ID will work universally. Definitely gave me some good reading, thanks a ton!! :) – mistiry Jan 05 '12 at 21:33
  • @Mistiry: Considering that iPhones do not support NFC, you have bigger problems... :-) – CommonsWare Jan 05 '12 at 21:43
0

Using ForegroundNdefPush is using a peer-to-peer mode. To get a unique number for that you would most likely have to write your own app, and create your own ID numbers.

When the phone behaves like a tag, you don't have any access to the information on the tag. And from what I saw on the Nexus S, the tag ID given when you hold your phone to a reader is a random ID, different every time.

I don't think you can get by without a special app for the phone. Unless you can get by with sticking a NFC sticker to the phone, but I have no Idea how that would interfere with the phones NFC reader!

Ben Ward
  • 874
  • 5
  • 12