Meta glasses2026Server and Android app, in a team of four

Glance

A hands-free shopping protocol for Meta glasses, built at the Junction hackathon. You look at a product, hear its price and nod to pay.

At the supermarket shelf, you pick up a carton and look at it. A voice in the glasses says "Oat drink, one litre, one eighty-nine. Nod to add." You nod, and the carton is in your cart. At the checkout you look at a code on the screen, nod once more, and you've paid without taking the phone out of your pocket.

We were a team of four, we built it in one weekend at Junction for Meta's challenge, and we demoed it live on real Ray-Ban Meta glasses. My part was the software. I wrote the design and the plans, and I built the server, the Android app, the phone screens and the checkout page, with a coding agent doing a lot of the typing while the team slept. The hardest problem of the weekend was a nod that reached the phone twelve seconds after it happened.

Meta's challenge at Junction

Meta's challenge at Junction was called "AI Glasses for Everyone, Everyday": find an everyday task that gets easier when a computer sees what you see. A quarter of the score went to what the brief called "input, accessibility and trust".

The brief also asked for a prototype that copes with "permissions, errors, performance trade-offs, connectivity, and device state changes". By the end of the weekend we had met every item on that list in person.

We picked the supermarket. Today you either queue at the belt and unload the whole basket, or you scan as you shop with one hand stuck holding a phone. For a blind or low-vision shopper, a self-checkout is a flat sheet of glass that says nothing at all. Glasses with a camera already see what your hands are holding, and they can talk into your ears.

How a glance works

You hold a product up. The glasses stream video to the phone, the phone sends frames to our server, and the server works out what you're holding. The voice says the name and the price, and ends with what a nod will do. You nod, and it answers "Added oat drink. Total four forty-nine." At the checkout you look at the code on its screen and hear "Checkout 3 at Kivenlahti Market. Two items, four euros forty-nine. Nod to pay." One more nod and you're done.

One rule holds it all together: looking never changes the cart. A glance only tells you about a product. A yes changes the cart, and silence never adds and never pays. Every spoken prompt has an ID, and the phone sends that ID back with your answer, so a late yes for something you already put down can't add the next thing you pick up.

The head is only one way to answer. A double tap on the glasses, a volume key, your voice and a button on the phone all work too, and every line the voice speaks also shows up as a caption on the phone. If you set allergens, the line for a product with gluten ends with a warning. When two products look alike, the voice admits it: "I cannot tell which oat drink this is. Turn the front to me."

The app also speaks Italian. The agent translated every line during the night and noted, with some honesty, that no native speaker had read them yet. There was an Italian on the team.

Paying with a nod

On the last night we stopped calling Glance a shopping app, because the store was only the first place. Any place can show a Glance code, a plain QR code with a short text in it, like GL1 K3X7. When you've looked at it for a second and a half, the phone reports it, the server links your session to that place, and the voice tells you what a nod will do there.

The Glance checkout page of Checkout 3 at Kivenlahti Market: a large QR code on the left and, on the right, Paid, 4.49 EUR, rye bread 2.60 EUR and oat drink 1.89 EUR, and the line No money moved.

Two rules carry the whole idea. The voice says what a nod will do before a nod can count. And a nod only counts while you're looking at the code, so a nod at checkout 3 pays checkout 3. In the pitch the same code went on the door of a bus: "Line 4 to the harbor. Single ticket. Nod to buy." We never built the bus.

Paying with a nod is an old idea. A Google Glass app called Eaze already let you pay by nodding twice, in bitcoin only, and asked for a PIN above a spending limit. With bitcoin, the price could change while you were still nodding. We had our own version of that limit, and it lasted about half a day. On the first morning, any total over 50 euros asked for a fingerprint on the phone, because anyone wearing the glasses can nod. By the evening the app could run a whole session with the screen off and the phone in a pocket, and a pocket has no fingers. The fingerprint became a setting, off by default.

Building on Meta's toolkit

Glance is a phone app built on Meta's Wearables Device Access Toolkit. The glasses run none of your code. The toolkit lets an Android or iOS app use the glasses' camera stream, their microphones and speakers and, as a beta feature, their motion sensors. Ray-Ban Meta glasses have no screen, so the voice is the whole interface. The Android SDK comes with a Mock Device Kit that pretends to be a pair of glasses inside the app, and most of Glance was written and tested against it before anyone put real glasses on.

One glance goes like this:

  1. The glasses stream video to the Android app over Bluetooth.
  2. The app pixelates every face in the frame before anything leaves the phone.
  3. About six times a second, it sends the sharpest recent frame to the server.
  4. The server asks Gemini what the frame shows, with the store's product list in the question.
  5. Two answers in a row for the same product open a prompt.
  6. ElevenLabs turns the line into speech, and the phone plays it through the glasses.
  7. While the line plays, the app watches the motion of your head.

The server is TypeScript on Fastify, with MongoDB to keep the sessions, and it's the only part allowed to change a cart or a total. All of its rules live in one function that never touches the network or the clock: it takes the state of a session and one input, and returns the new state and what to do next. That made every rule testable, because a test can replay any moment of a shop exactly. Without API keys, small scripts stand in for Gemini and ElevenLabs, and the whole shop runs without a bill.

The voice has one trick worth stealing. When a product prompt opens, the server already asks ElevenLabs for the two possible answers, "Added oat drink" and "Skipped", so the reply to a nod never waits for speech to be generated. And because Gemini sees the store's own list, it matches by meaning: a can with Finnish text on it still matches an item we named in English.

For Meta Ray-Ban Display glasses, which have a small screen, I also built a mockup of a heads-up display with Meta's UI toolkit for it, showing the product, the price, the warning and two buttons.

A night shift for a coding agent

We started the first evening with an empty repository. By the small hours I had written a design, five implementation plans and one last file: a brief "for the session that builds Meta Glance while the team sleeps".

The session was Claude Code, running in a loop that never stopped by itself. The brief told it to read everything first, because "The team cannot answer questions until the morning." Then came eighteen rules. A few of them:

Never wait for a person. If a step needs a person, a secret, or the real glasses, write it in docs/overnight/MORNING.md and continue with the next step.

Do not invent an SDK call.

The team has little money for the vendors.

The budget for the night was 20 calls to Gemini and 5 to ElevenLabs. The plans had been written for the four of us, so the brief told the agent to do all four people's work itself, in parallel, each part in its own copy of the repository.

By late morning the whole shop ran end to end on a phone with simulated glasses. The agent had used 2 of its 20 Gemini calls and none of the ElevenLabs ones, and it reported, quite correctly, that nobody had heard the app's voice yet. The first open item on its list was that nothing had run on real glasses. That was true too. It had spent the night building a shop and almost none of the money, which is the opposite of how shopping usually goes.

So the agent did most of the typing. I spent the evening writing what it should type, and the next day checking what it had typed against real glasses. The rest of the team took care of the pitch and its script, a video, the intro animation, the team photos and putting the product site online.

The first day with real glasses

The morning after the night shift, we put the real glasses on for the first time.

The first problem fits in one sentence: the phone couldn't read a barcode at arm's length. A barcode is small and the camera is wide. So the phone now tries harder before it gives up. It runs the barcode scanner, then reads the digits printed under the bars, then takes a still photo, and as a last resort sends the label to Gemini.

The second problem was in the pictures. Some frames came through as big blocks of smeared color. The glasses compress the video to squeeze it through Bluetooth, and when a piece of the stream goes missing, the decoder paints blocks until the stream recovers. Those blocks always sit on a grid of 16 pixels, while a real scene has its edges anywhere. So the app counts how many sharp edges fall on that grid, and a frame that looks like a broken mosaic never leaves the phone. Mosaics are lovely in Ravenna and useless on a supermarket shelf.

The third was a measurement that killed my own feature. I had added a detector that crops the product out of your hand, so that Gemini gets more pixels of the can. On that day's frames, the crop alone recognized 10 cans out of 65, and the full frame recognized 16. The crop is off by default now.

Then came the nods. In the first test, one answer took seven nods before the app accepted one, because the head was also turning a little to the side. Seven nods to say yes once is closer to headbanging than to shopping.

Later that day a second person lost most of their nods for a different reason: they looked down at the can before nodding. We had taken our axis map from an Android sample without checking it on these glasses. For a head tilted down at a product, the axis we treated as ear to ear was really pointing forward, so a nod of 21 degrees looked like a nod of 2. That evening we fixed the axes and turned the recordings into a test.

Telling a nod from a look

The glasses send motion samples 30 times a second. Each one has a gyroscope reading, which says how fast the head is turning, and an accelerometer reading, which says where down is. The app uses gravity to split every turn into two parts: up and down, around the axis from ear to ear, and side to side, around the vertical. Adding up the speeds over time gives two angles that follow the head.

Each angle is cut into strokes. A stroke is a movement in one direction, and it ends when the head reverses or holds still for a quarter of a second.

A nod is two opposite up-and-down strokes back to back, down and up or up and down. The second stroke has to bring the head back to within 40 percent of the bigger stroke. That's what separates a nod from a look down at the product: a look goes down and stays there. On top of that:

That last rule is the fix for the seven-nod answer. The first version compared how far the head moved on each axis, so a small fast nod during a slow turn of the head lost to the turn. Comparing speeds lets it through, because a nod is quick and a turn is slow.

SettingSmallest strokeSmallest speed
Gentle4 degrees34 degrees a second
Normal6 degrees46 degrees a second
Firm9 degrees69 degrees a second

The app doesn't wait for the head to come all the way back. It accepts the nod as soon as the second stroke is far enough along, which on real glasses was 300 to 430 milliseconds after the nod started. After a nod it ignores the head for a moment, so a nod with three or four bounces counts once, and an enthusiastic shopper doesn't buy four oat drinks.

A shake is stricter. It needs two opposite side-to-side strokes and the start of a third, because a single look to the side and back is the most common thing a shopper's head does, usually right after reading a price. A study of head gestures found that most people start a nod by moving up, so the detector takes both directions. Five minutes of simulated walking, at every setting, produces no gesture at all.

Your cursor can stand in for the head. Move it over the dotted line below: a quick flick down and back up is a nod, a slow sink that stays is a look, and a quick shake side to side skips. The rules are the ones above at the Normal setting, and a nod they accept lights up:

Oat drink, one litre, one eighty-nine. Nod to add.

The nod that arrived twelve seconds late

The hardest bug of the weekend was about time.

The Bluetooth link from the glasses to the phone stalls. On the first day the stalls lasted from 3 to 12 seconds. Nothing reaches the phone during a stall, and then a few hundred motion samples arrive at once.

Each prompt has a head window, the stretch of time in which a nod counts as the answer. It opens 0.3 seconds after the voice line starts, because nobody reacts to a sound faster than that, and anything earlier is the head lifting the product. It closes 8 seconds after the line ends. Our first version timed that window by when the samples reached the phone.

Here's how that went wrong. Say the price line ends after 3 seconds, so the window closes at 11. A stall starts at 4 seconds and lasts 9. You nod at 6, well inside the window, but the glasses can't deliver your nod until the stall ends at 13. By the phone's clock the window had closed two seconds earlier, so the phone threw your nod away. You nodded on time, and nothing happened.

It also went wrong the other way. A movement made before the window opened, like lowering the product, could arrive late, land inside the window and count as an answer nobody gave.

The fix was to time the window by when the glasses took each sample. Every sample carries a timestamp from the glasses' own clock, which has nothing to do with the phone's clock. The phone works out the difference between the two from the samples themselves:

/** The phone time at which the glasses took the sample. */
fun phoneMs(sampleNs: Long, arrivalMs: Long): Long {
    val sampleMs = sampleNs / NS_PER_MS
    val delay = arrivalMs - sampleMs
    val before = offsetMs
    // The clock of the glasses never goes back. A sample time
    // that does is a new clock, for example a new mock feed.
    val offset =
        if (before == null || sampleNs < lastSampleNs || delay < before) delay
        else before
    offsetMs = offset
    lastSampleNs = sampleNs
    return sampleMs + offset
}

It keeps the smallest delay it has ever seen. The sample that made the quickest trip from the glasses is the best guess at the real difference between the clocks, and every later sample is placed with it. In the example, your nod now carries the time 6 seconds, inside the window, and it counts even though it arrived 7 seconds late.

Two more rules make it hold. While nothing arrives, the window's own clock stops, for up to 15 seconds, so a stall can't eat your time to answer. And a sample taken inside the window still counts if it reaches the phone up to 6 seconds after the window ends. The server has no way to see any of this, so it lets the phone decide, and only refuses an answer that comes more than 21 seconds after the window would have closed.

Two smaller fixes came out of the same hunt. Taking a still photo stops the motion samples for a few seconds, so the app now takes no photo while a prompt waits for your answer. And the first version read the samples on the main thread into a buffer of 64, which lost samples every time a stall ended with hundreds of them. Now they go into a queue with no limit, on a thread of their own.

The demo and after

We demoed Glance live on Ray-Ban Meta glasses. I built the deck from the app's own screens, and on the last night the second product in it turned from a rye bread into a Fanta.

Afterwards the team was invited to an AI forum with Oura, Polar and Meta. The weekend itself, from the hall to that invitation, is in my note on Junction.

Visor, my other project on these glasses, talks to them at the level of their own protocol. Glance is built on the toolkit Meta made for developers, which is the supported way in. The code is on GitHub.

Contracting from January, and open to more: web and Android apps, and integrations.me@marco.win