Skip to content

Implement Android support for connectivity detection #10

@velocitysystems

Description

@velocitysystems

Summary

Implement Android support for connection_status().
The types, command, permissions, and JS/TS bindings have already been merged in #2.

Android exposes everything needed through ConnectivityManager and NetworkCapabilities (available since API 23, with registerDefaultNetworkCallback since API 24): reachability via the active Network and NET_CAPABILITY_INTERNET / NET_CAPABILITY_VALIDATED, metered state via the absence of NET_CAPABILITY_NOT_METERED, the constrained flag via Data Saver (getRestrictBackgroundStatus) and NET_CAPABILITY_TEMPORARILY_NOT_METERED, and the active transport via TRANSPORT_WIFI, TRANSPORT_ETHERNET, and TRANSPORT_CELLULAR. Implementation will follow Tauri's mobile plugin pattern with a Kotlin bridge under android/src/main/ invoked from Rust via the plugin's mobile entry point.

The existing ConnectionStatus field mappings in src/types.rs already document the Android counterparts (NET_CAPABILITY_NOT_METERED, RESTRICT_BACKGROUND_STATUS). The plugin manifest will need to declare android.permission.ACCESS_NETWORK_STATE.

Out of Scope

  • Windows, Linux, macOS, and iOS backends — separate follow-ups.
  • Change-notification / observer APIs for status transitions (NetworkCallback).
  • Data-limit fields (approaching_data_limit, over_data_limit) — not distinctly exposed by NetworkCapabilities (only the rolled-up metered / Data Saver signals).
  • Roaming flag — NET_CAPABILITY_NOT_ROAMING is available but folded into constrained rather than surfaced as a separate field.
  • Legacy NetworkInfo fallback for pre-API 23 systems — minimum target is API 23+.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions