See how Capacitor fits into the entire Ionic Ecosystem ->
Capacitor is part of the Ionic Ecosystem ->


The Network API provides events for monitoring network status changes, along with querying the current state of the network.


import { Plugins } from '@capacitor/core';

const { Network } = Plugins;

let handler = Network.addListener('networkStatusChange', (status) => {
  console.log("Network status changed", status);
// To stop listening:
// handler.remove();

// Get the current network status
let status = await Network.getStatus();

// Example output:
  "connected": true,
  "connectionType": "wifi"

Android Note

The Network API requires the following permission be added to your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

This permission allows the app to access information about the current network, such as whether it is connected to wifi or cellular.