←BaldanAll worksLet's talk

Case study · Indosat · Circle Kalisumapa · 2026

PROTRACK: proof the promoter was really there.

Promoters sell IM3 and 3 SIM cards at phone shops and are paid per card. PROTRACK is the app they work in: check in at the outlet, record each card sold, see whether it activated. Every step checks where they are and which phone they use, because money depends on it.

Built end to endFastAPI · Firestore · Cloud RunAndroid (Kotlin)
Try to fake a check-in ↓
PROTRACK home: the promoter is checked in at an outlet, with this month's visits and cards sold

Screens: the real app running on demo data. No real promoters, outlets or phone numbers.

01 · A visit

Three steps, each one checked.

A promoter can't move to the next step before the last is done, and nothing can be sent from outside the outlet.

Step 1: GPS locked, outlets within 500 m listed nearest first
1

Lock GPS

The server measures the distance to every outlet in the master list in one vectorised pass and returns those within 500 m, nearest first.

Step 2: the picked outlet is 823 m away, shown in red as outside the radius
2

Pick the outlet

The distance is checked as soon as an outlet is picked. Too far, and the check-in can't be sent. The server checks again anyway.

Step 3: inside the radius at 46 m with a camera photo taken; the send button is active
3

Photo from the camera

The photo button opens the camera, not the gallery, so an old photo can't be reused. Then the button turns on.

02 · Try to cheat

Seven checks before a check-in is saved.

Sales fees depend on check-ins, so people will try. Pick your tricks and send: the server runs its checks in this order, and the first one that notices stops the request with the app's real message.

Pick your tricks

1 trick on. The first check that notices one stops the request.

Server · POST /checkin

  1. 1

    Signed by a registered phone

    a key in Android Keystore signs a one-time nonce and timestamp

  2. 2

    It's a photo

    jpeg, png or webp, taken with the camera

  3. 3

    GPS isn't faked

    Android's own mock-location flag

  4. 4

    The trip is possible

    distance and time since the last check-in

  5. 5

    No other visit open

    one outlet at a time

  6. 6

    The outlet exists

    looked up in the outlet master list

  7. 7

    Within 500 m of the outlet

    great-circle distance to the outlet's coordinates

03 · Why an Android app

A web app in a native shell, for what browsers can't do.

The screens are one web app, so updates ship without a new APK. The Android shell adds three bridges the browser doesn't have.

A fake-GPS app is detected: the app refuses to lock the location
  • Location bridge

    Reads Android's own mock-location flag (Location.isMock), which no browser can see. A fake-GPS app is caught on the phone, and the server refuses the request too.

  • Device key

    On first use the phone makes a key pair inside Android Keystore. The private key never leaves the phone; the server keeps only the public key. Every check-in is signed over a one-time nonce and a timestamp, so a request copied off the phone can't be replayed, and a decompiled APK holds no secret.

  • Camera

    Photo fields open the camera directly, so evidence is taken there and then.

how a check-in is signed

Phone

nonce = random UUID

ts = now

sig = sign(nonce:ts) in Keystore

→ headers →

Server

ts recent? else refuse

nonce used before? refuse

verify sig with stored public key

04 · Every SIM once

Scan it, and it can only count once.

Each SIM card sold is a fee, so the same number must never be claimed twice, by the same promoter or anyone else.

  • Scan, then locked

    Scanning the barcode on the SIM pack fills the number and locks the field; changing it means scanning again. Each record notes whether it was scanned or typed.

  • Warned while typing

    A live check says if the number was ever submitted, by anyone. Only the latest response counts, so a slow reply can't show a stale warning.

  • One claim, guaranteed

    On save the server claims the number in a transaction, one document per number, so two taps at the same moment can't both win. If the photo upload fails after that, the claim is released.

  • Still at the outlet

    Submitting checks the 500 m radius again, so a forgotten logout can't be used to submit from somewhere else.

Submitting a SIM card: the scanned number is locked and flagged as already submitted, so Save stays off

05 · Did it activate?

Every card checked against the activation data.

A sale only counts if the card was activated. The monthly activation (GA) files are read straight from the same Cloud Storage bucket the admin portal uses: no copies to drift apart.

GA Status: each submitted number marked as in process, valid or not valid

The server builds a lookup of each number's first activation date across all months (cached for half an hour), then compares it with the day the promoter submitted it.

GA ValidActivated on or after the day it was submitted.
Tidak ValidActivated before the promoter claimed it, so someone else sold it.
Proses ValidasiNo activation in the data yet.

06 · The small stuff

What keeps it honest on a busy day.

Location only while working

During an open visit the app sends its position every minute, appended to the visit's route for the live map in the admin portal. Logging out of the outlet stops it.

One visit at a time

A quick check rejects a second check-in early; a Firestore transaction guarantees it when two requests race.

Only real promoters sign up

The ID must be on the official SalesHub roster. ID, email and phone number are each unique, phone numbers normalised to 62…

Rate limits that hold

Login and sign-up attempts are counted in Firestore, not in memory, so the limit is shared by every server instance.

Sessions and passwords

A 12-hour JWT in an httpOnly, secure cookie; passwords hashed with bcrypt; security headers and a strict content policy.

Messy outlet data

About 0.4% of outlets have missing or impossible coordinates. They're marked “location not validated” instead of wrongly rejecting the promoter.

Light photos

Every photo is compressed on the server before it goes to Cloud Storage.

Old app versions

The web app detects an outdated Android shell and tells the promoter where to get the new one.

07 · How it fits together

One backend, one bucket, two front doors.

Promoter's phone

PROTRACK app

Kotlin WebView shell: fused location, Keystore signing, camera. Web app inside: vanilla JS, ZXing barcode scanner.

Google Cloud Run

FastAPI backend

Auth, outlet search, check-in, checkout, live tracking, SIM tagging, GA status. Pandas for the outlet master and GA files.

Firestore

promoters, check-ins, SIM claims, device keys, nonces, rate limits

Cloud Storage

photos, outlet master, GA files, activity log

Office

Admin portal

Live tracking map, access management, GA validation for fee claims, on the same data.