NFC source code

94 views
Skip to first unread message

Rick

unread,
May 23, 2011, 12:47:00 AM5/23/11
to foursqu...@googlegroups.com
Well after watching the Google I/O's how to NFC segment I went and ordered some tags for us to start playing with here in the office. They just rocked up today and I was hoping the powers that be could provide the source code or examples etc for a simple venue checkin. 

Thanks in advance!

Kapil Israni

unread,
May 23, 2011, 12:55:12 AM5/23/11
to foursqu...@googlegroups.com, foursqu...@googlegroups.com
Hi Rick - can you share where you bought the NFC tags from. Thanks a lot.

Sent from my iPhone. Please excuse typos and terseness.

On May 22, 2011, at 9:47 PM, Rick <fores...@gmail.com> wrote:

Well after watching the Google I/O's how to NFC segment I went and ordered some tags for us to start playing with here in the office. They just rocked up today and I was hoping the powers that be could provide the source code or examples etc for a simple venue checkin. 

Thanks in advance!

Rick

unread,
May 23, 2011, 1:10:11 AM5/23/11
to foursqu...@googlegroups.com
Purchased online from: http://www.tagage.net/ 

we ordered 2 types to play with: 
  1. Mifare Classic Racetrack 49 x 81 mm
  2. Mifare Classic Bullseye 40 mm
Delivered within 10 days to Australia as published on their website. 

Akshay Patil

unread,
May 23, 2011, 2:07:52 PM5/23/11
to foursqu...@googlegroups.com
Hey Rick,

NFC check-ins are Android intent powered. Just write something a url
of the format "http://m.foursquare.com/checkin?vid=%venueid%" to the
tag (via an app like TagWriter, available in the android market) and
the Android tag reader should do the rest!

~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi

Mohan Arun

unread,
May 23, 2011, 4:47:23 PM5/23/11
to foursquare API
>NFC check-ins are Android intent powered. Just write something a url
>of the format "http://m.foursquare.com/checkin?vid=%venueid%" to the
>tag (via an app like TagWriter, available in the android market) and
>the Android tag reader should do the rest!

NFC check-ins is new to me:
Is this something which can be done by the owner of a venue so when
patrons
come in they can 'scan' the QR code placed near the entrance and they
will be checked in to the venue?

But Wikipedia says the NFC range is 4 cm or less? Patrons will have to
swipe their handhelds too close
for this range to work for identifying the venue via QR?

Do you think they could make 'disposable' one-time use only (OT) tags
so you could pick one near a venue entrance, scan it, and it will
'check you in'?

Am I missing something here or am I thinking 'outside the box' too
much?

- Mohan
http://www.mohanarun.com

Akshay Patil

unread,
May 23, 2011, 5:00:20 PM5/23/11
to foursqu...@googlegroups.com
QR codes will work too. Just have the QR payload be of the mobile
foursquare URL payload I linked to earlier and when the user clicks on
it, Android will recognize the installed foursquare app's intent to
handle that URL and direct the user to the foursquare app
appropriately.

For other Android intents you can surface, check out:
http://code.google.com/p/foursquared/wiki/FoursquareIntents

~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi

Dave Ingram

unread,
May 24, 2011, 7:31:21 AM5/24/11
to foursqu...@googlegroups.com
On 05/23/11 21:47, Mohan Arun wrote:
>> NFC check-ins are Android intent powered. Just write something a url
>> of the format "http://m.foursquare.com/checkin?vid=%venueid%" to the
>> tag (via an app like TagWriter, available in the android market) and
>> the Android tag reader should do the rest!
> NFC check-ins is new to me:
> Is this something which can be done by the owner of a venue so when
> patrons
> come in they can 'scan' the QR code placed near the entrance and they
> will be checked in to the venue?
>
> But Wikipedia says the NFC range is 4 cm or less? Patrons will have to
> swipe their handhelds too close
> for this range to work for identifying the venue via QR?
QR and NFC are separate technologies. A QR code is something that can be
printed, or even displayed on a huge billboard (like in Japan). It uses
the phone's camera, and is a bit like a barcode. Once it's printed, it
can never change. It does rely on a suitable contrast between
white/black sections in order to work, so a decent light source is
usually required in dark areas.

NFC is a short-range radio technology, and is similar to some of the
anti-theft tags used in shops (in the same way that a QR code is similar
to a barcode). NFC tags can hold data, and can be read by a device that
is sufficiently close. It requires special hardware in the reader, but
because it's radio-based, the tag itself can be embedded invisibly in
another object. You should also be aware that NFC tags can be rewritten
by anyone with the right hardware.* This hardware for writing tags
already exists in some phones like the Nexus S. Other examples of NFC
tags are some rapid transit cards (e.g. London's Oyster card) and some
building entry/access cards.

> Do you think they could make 'disposable' one-time use only (OT) tags
> so you could pick one near a venue entrance, scan it, and it will
> 'check you in'?

With the assistance of an app to ensure the code is only ever used once
(and you'd have to decide whether this is once per 4sq account or once
by anyone, ever) this is indeed possible. I think it would be easiest to
do this with QR codes rather than NFC tags.


Dave


* Yes, this is a generalisation to keep the explanation simple. Some
tags can be made permanently read-only, or they might have some crypto
that requires authentication with some keys before write access is granted.

Luke

unread,
May 24, 2011, 7:35:59 AM5/24/11
to foursquare API
This worked perfectly, thanks Akshay. I saw a post somewhere that
mentioned it used intent, but it the post had no reference as to what
intent it might be powered by ;-)

Mohan Arun

unread,
May 25, 2011, 5:23:57 AM5/25/11
to foursquare API
> > Do you think they could make 'disposable' one-time use only (OT) tags
> > so you could pick one near a venue entrance, scan it, and it will
> > 'check you in'?
>
> With the assistance of an app to ensure the code is only ever used once
> (and you'd have to decide whether this is once per 4sq account or once
> by anyone, ever) this is indeed possible. I think it would be easiest to
> do this with QR codes rather than NFC tags.
>
> Dave

Thanks for the explanation, Dave. I was thinking whether these one-
time use tags
could be pre-printed and placed near a business entrance so patrons
can pick
one up, scan it with their phone and have themselves checked in to the
venue. The
one-time use is once per checkin.

Are there any how-to guides about how a biz owner can print QR codes
and patrons will scan the QR code and have themselves auto-checked in
to the venue?

- Mohan

michaelg

unread,
May 24, 2011, 10:03:41 PM5/24/11
to foursquare API
Hi Akshay,

Are custom URI schemes like used by your iPhone app also supported by
your Android app? I mean like foursquare://venue/foo. See here:
http://groups.google.com/group/foursquare-api/browse_thread/thread/712c82fad08dd88e?pli=1.

-- Michael

On May 23, 11:07 am, Akshay Patil <a...@foursquare.com> wrote:
> Hey Rick,
>
> NFC check-ins areAndroidintent powered. Just write something aurl
> of the format "http://m.foursquare.com/checkin?vid=%venueid%" to the
> tag (via an app like TagWriter, available in theandroidmarket) and
> theAndroidtag reader should do the rest!

Akshay Patil

unread,
May 25, 2011, 6:19:30 PM5/25/11
to foursqu...@googlegroups.com
Hi Michael,

No, they're not supported on Android. In general we try to normalize on the http://m.foursquare.com urls for NFC/QR/etc. because it degrades gracefully to the mobile experience on all platforms


~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi


Luke

unread,
May 31, 2011, 10:41:54 PM5/31/11
to foursquare API
Ashkay I had an NFC tag working using intent as you suggested, but
after the latest Foursquare update it seems to have broken. When I
scan the tag, Foursquare opens immediately now (previously Android
would ask what app I would like to open), but to a blank check-in
screen (a check-in screen with no details about the venue I'm checking
in to). It let's me check-in to the imaginary venue, but doesn't
actually record the check-in, or give me any points or anything like
that.

Any ideas as to what's happened in the latest update?

On May 26, 8:19 am, Akshay Patil <a...@foursquare.com> wrote:
> Hi Michael,
>
> No, they're not supported on Android. In general we try to normalize on thehttp://m.foursquare.comurls for NFC/QR/etc. because it degrades gracefully
> to the mobile experience on all platforms
>
> ~ak
> --
> Akshay Patil / Foursquare Platform Evangelist
> @akdotcom / @foursquareapi
>
>
>
>
>
>
>
> On Tue, May 24, 2011 at 10:03 PM, michaelg <mike...@gmail.com> wrote:
> > Hi Akshay,
>
> > Are custom URI schemes like used by your iPhone app also supported by
> > your Android app? I mean like foursquare://venue/foo. See here:
>
> >http://groups.google.com/group/foursquare-api/browse_thread/thread/71...
> > .

Akshay Patil

unread,
May 31, 2011, 11:06:38 PM5/31/11
to foursqu...@googlegroups.com
Hi Luke,

We made a change to register the foursquare app to launch directly for
read NFC tags (rather than requiring the built in Tags app to publish
the intent). It *should* just continue working with the intent URLs I
mentioned earlier. What's the URL you've written to your tag?

~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi

Luke

unread,
May 31, 2011, 11:16:11 PM5/31/11
to foursquare API
The URL I'm using is: http://m.foursquare.com/checkin?vid=402792 which
was working fine last week using the intent method. I've tried re-
writting the tag just in case, but no joy.

Akshay Patil

unread,
Jun 1, 2011, 11:47:02 AM6/1/11
to foursqu...@googlegroups.com
Hey Luke,

Looks like that flow is broken now that we grab the NFC intent directly. Can you try switching to the venue intent instead?   m.foursquare.com/venue/xxx


~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi


Luke

unread,
Jun 1, 2011, 6:27:44 PM6/1/11
to foursqu...@googlegroups.com
That works just fine now Ashkay, thanks for investigating!

Regards,
Luke
Reply all
Reply to author
Forward
0 new messages