# Working offline on mobile and how sync works

The mobile app keeps a copy of your school's data on the phone so a launch site with no signal still works. You can register students, sign compliance documents and complete tandem flights offline; those changes queue and push themselves the moment you reconnect. Almost everything else is read-only offline.

Source: https://help.pigi.io/guides/mobile/offline/offline-and-sync

## Quick answers

**Can I use the app with no signal?**
Yes, for the things that matter on a flying day. You can register a student, sign
their compliance documents, edit and complete a tandem flight, and read your
cached students, flights, equipment, licences, recons, flying sites and weather
readings. Everything is stored on the phone and pushed when you reconnect.

**What can I not do offline?**
Create or edit a personal flight, create a tandem flight from scratch, add or edit
equipment, add or edit a licence, edit a student's details, create or edit a
flying site, or switch company. Each of those refuses with an **Offline** message.

**How do I know the app is offline?**
A coloured strip appears above the header on the tab screens. Red **"Offline"**
means no network at all; amber **"Server unavailable"** means you have a network
but the PiGi server is not answering. Both add **"— N pending"** when you have
unsynced work.

**How often does the app sync?**
On sign-in, every time you bring the app back to the foreground, whenever the
network comes back, every five minutes while online, and whenever you pull to
refresh. Signing a document also fires a push immediately.

**Which way round does sync run?**
Push first, then pull. Your local changes go up before the server's data comes
down, so a fresh pull never overwrites work you have not sent yet.

**A banner says registrations failed to sync. What do I do?**
Tap it. That opens **Registration queue**, which lists every registration still
waiting. Tap **Retry now** on a row once you are back online. The student's
details and their signed documents are still on the device — nothing has been
lost.

**How many times does a failed registration retry itself?**
Three. After that it stops retrying automatically and stays visible in the red
banner so it cannot be lost quietly. A rejection the server will never accept —
a bad email, a permission problem — is marked permanent immediately.

**What do the queue statuses mean?**
**Waiting to sync** means it has not been sent yet. **Syncing…** means it is going
up right now. **Failed to sync** means the last attempt was rejected, and the row
shows the reason.

**Can I delete something from the queue?**
Yes, with the bin icon — but only do it for a genuine duplicate. The confirmation
warns that it permanently removes the student *and any signed documents saved with
it* from the device, and that it cannot be undone.

**Does my offline data ever go stale?**
Yes. Cached lists are replaced wholesale on each pull, and only the most recent
200 recons are kept. There is no "last updated" stamp on the read-only screens, so
if you have been offline for days, treat the numbers as approximate.

## What is stored on the phone

The app keeps a local database with three kinds of table:

- **Queues you write to** — student registrations, tandem flights, compliance
  documents, bookings and calendar events. These carry a "needs sync" flag.
- **Read-only caches** — students, personal flights, personal equipment, personal
  licences and pilot recons.
- **Lookups the forms need** — countries, company pilots, flying sites, compliance
  requirements and compliance document templates.

Weather station readings are cached separately, and so are your reserved
compliance-document codes.

## The offline flying day

1. **Before you leave signal**, open the app while online so a sync runs. That
   fills the lookups and tops up your reserved document codes.
2. **At the site**, register students as normal. Each registration creates a local
   flight and a local set of compliance documents, consuming one reserved code
   each.
3. **Sign the documents** on the device. The signature is stored locally and
   marked to sync.
4. **Fly, then complete the flight** from the tandem flight screen — status,
   debrief, media, tips, expenses and cash all save locally.
5. **Back in signal**, the app pushes everything automatically. Watch the banner:
   it turns blue while syncing and green when the registrations land.

## Reading the banner

| Colour | Meaning |
|---|---|
| Red | No network, or registrations that have stopped retrying — tap to review |
| Amber | Network is up but the server is not answering, or some records failed |
| Blue | Syncing, or items pending |
| Green | Registrations synced — tap for details |

Tapping a green or amber "tap for details" banner opens **Sync Results**, which
lists each registration by name and email with its outcome.

## Known limitations

- **The banner is tab-only.** Drawer screens show no offline state.
- **The registration queue is only reachable from the banner.**
- **Offline lists sort differently.** The students list is ordered by when it was
  cached rather than when the student was created, and offline date filters on
  students are ignored, so filtered counts can be wrong.
- **Duplicate students are not caught offline.** The "does this email already
  exist" check cannot run, so a returning student registered offline may create a
  duplicate that only surfaces at sync time.
- **Flying sites lose detail offline.** Cached sites come back without
  coordinates or elevation and are all labelled as mixed sites.
- **Equipment groups are unavailable offline** even though the equipment list is
  cached.

## Related

- [Register a student on mobile](students-on-mobile.md)
- [Documents and signing on mobile](documents-and-signing.md)
- [Tandem flights on mobile](tandem-flights-on-mobile.md)
