Skip to content

Add network connectivity ios android#2

Open
J4t-P wants to merge 5 commits into
masterfrom
add-network-connectivity-ios-android
Open

Add network connectivity ios android#2
J4t-P wants to merge 5 commits into
masterfrom
add-network-connectivity-ios-android

Conversation

@J4t-P
Copy link
Copy Markdown
Collaborator

@J4t-P J4t-P commented Apr 10, 2026

Plugin detects the connection type and verifies whether the device actually has internet access in real time.

Why this plugin?
The built-in Capacitor Network plugin only tells you if the device is connected to a network interface. But being connected to WiFi doesn't mean you have internet — think captive portals, dead hotspots, or firewalled networks. This plugin distinguishes between those cases.

How it works
The plugin returns an InternetStatus object with four fields:

Field Description
connected Whether the device is connected to any network (WiFi, cellular, etc.)
internetReachable Whether the device can actually reach the internet
connectionType The active transport: wifi, cellular, none, or unknown
state High-level status: online, limited (connected but no internet), or offline

iOS
Uses NWPathMonitor to detect network changes, then validates actual internet access by firing concurrent HTTP HEAD requests to 4 well-known servers (Google, Apple, Cloudflare, Microsoft). If any responds successfully, internetReachable is true. This catches captive portals and dead WiFi networks that NWPathMonitor alone would report as "connected".

Android
Uses ConnectivityManager with NetworkCallback to monitor network changes. Internet reachability is determined via NET_CAPABILITY_VALIDATED, which is Android's built-in mechanism for verifying actual internet access at the OS level.

Web
Falls back to navigator.onLine with online/offline event listeners.

Compatibility
Capacitor >= 7.0.0
iOS 14+
Android API 23+ (minSdk), targeting API 35

@J4t-P J4t-P self-assigned this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant