Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Determine Online or Offline Status

The Salesforce Mobile app, Field Service Mobile app, and Lightning Web Components generally, don’t have a supported mechanism for detecting whether a device is online or not. This is by design.

Online vs. offline connectivity is dynamic, and the signal given to the app from the mobile operating system is notoriously unreliable. This lack of a clear signal is because the state of connectivity changes frequently. Connectivity isn’t a simple on/off switch. There’s a range, from totally offline, to spotty, to slow-but-solid, and all the way up to faster than wired speed in the best circumstances. There’s no good way to know if an action that requires a network connection will succeed or fail, except by attempting it.

In general, our design goal is that LWCs work offline first, and treat being offline as a normal condition, not a failure. When a network request doesn’t succeed, the condition is handled as gracefully as possible. We recommend your components adhere to this practice.