Usage
Check the current network status:Network Status Object
Thestatus() method returns an object with the following properties:
Connection Types
Thetype property can be one of the following values:
wifi- Connected via Wi-Ficellular- Connected via cellular data (3G, 4G, 5G, etc.)ethernet- Connected via Ethernet (rare on mobile, but possible)unknown- Connected but type cannot be determined
Examples
Basic Connectivity Check
Connection Type Check
Check for Expensive Connections (iOS)
Respect Low Data Mode (iOS)
Livewire Component Example
Methods Reference
status()
Returns the current network connectivity status.
Returns: object|null
Object Properties:
connected(bool) - Whether the device is connected to a networktype(string) - Connection type:"wifi","cellular","ethernet", or"unknown"isExpensive(bool, iOS only) - Whether the connection is metered or cellularisConstrained(bool, iOS only) - Whether Low Data Mode is enabled
null if:
- The native bridge is not available
- Network status cannot be determined
Platform Notes
iOS
On iOS, the Network API provides additional properties:-
isExpensive: Indicates whether the current connection is considered “expensive” by the system. This includes cellular connections and metered Wi-Fi networks. Use this to avoid heavy network operations when users might be charged for data. -
isConstrained: Indicates whether Low Data Mode is enabled in system settings. When enabled, users have explicitly requested apps to minimize data usage. Respect this setting by:- Reducing image quality
- Disabling auto-play videos
- Deferring non-essential downloads
- Using cached content when possible
Android
On Android, the Network API provides the basic connectivity information:connected- Whether the device has network connectivitytype- The type of network connection
isExpensive and isConstrained properties are iOS-specific and will not be present in the response on Android. Always check for their existence before using:
Best Practices
Always Check for Null
Use Type Checking
Respect User Preferences
Cache Network Status
Avoid callingstatus() repeatedly. Cache the result when appropriate: