On This Page
Why Background Auto-Sync Fails Inside Plantation Blocks
Field coordinators running FMS Mobile work inside active blocks across 100+ plantation sites where mobile data drops regularly during inspections. When a coordinator tags Plant Pest Disease findings, logs Catatan Lokasi (Catatan / To Do / Doing / Done), or completes QC Inspector forms, silent background retry queues often create confusing partial failures or duplicate submissions once the device regains signal.
Instead of pretending the phone is always online, we designed the React Native 0.79 client around explicit local SQLite persistence (@op-engineering/op-sqlite) paired with clear manual sync states.
Unified field capture across Android mobile and Web monitoring
How offline-tolerant mobile inputs stay consistent with regional dashboards.
Local Schema Design With Explicit Sync Flags
Every field note captured inside the app writes immediately to the local op-sqlite table with is_synced = false and optional photo & GPS coordinate fields (coordinat). Only when the coordinator returns to better coverage and taps Sync Data does the batch upload reconcile local drafts against the Laravel REST endpoints.
// Offline queue record & pending sync filter (fms-mobile/src/database/dbNote.ts)
export type NoteRecord = {
id: number;
web_id?: string | null;
zone?: string | null;
location?: string | null;
status: string;
tagging?: string | null;
priority?: string | null;
description: string;
photo?: string | null;
coordinat: string;
is_synced: boolean;
note_code?: string | null;
type: string;
created_by: string;
};
export function countPendingUploads(rows: NoteRecord[]): number {
return rows.filter((row) => !row.is_synced).length;
}Two Key Architectural Trade-Offs
- Manual trigger over silent polling: asking coordinators to press Sync Data adds one deliberate tap, but gives field teams clear visual feedback on how many notes, Jurnal PPO logs, and Form Studio inspections are still queued locally on the device.
- Scoped REST contracts over full model replication: the Laravel backend accepts lean note payloads instead of syncing entire nested
Lokasilifecycle trees (Rawat, Diet, Forcing) back and forth on every upload.
Production Checklist Before Field Rollout
- Verify every new inspection module stores nullable
web_idso local drafts map cleanly once acknowledged by MySQL. - Keep photo URIs queued outside SQLite string blobs and mark
is_synced = truestrictly after HTTP200/201confirmation. - Confirm identical status enums (
Catatan,To Do,Doing,Done) between the Android client and Mantine web dashboard (fms.ggfsystem.com).