termux / termux/termux-api

Detecting (un)metered connection state

Open
#892 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

Feature description

I'm looking for a way to tell if the current connection is set as metered or not (including use of mobile data as well as Wi-Fi networks set as metered e.g. hotspots), so that I can guard scripts or steps of them from using large amounts of data where this is chargeable.

termux-job-schedule allows deferring jobs from running on metered connections with --network unmetered, though I'd like more fine-grained control that can also be used outside of work jobs.

It doesn't look like there's currently any transport-agnostic network tools here, and the existing Wi-Fi commands don't expose this information.

Reference implementation

NetworkCapabilities::getCapabilities() and NetworkCapabilities::NET_CAPABILITY_NOT_METERED

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Wi-Fi commands and the termux-job-schedule handling of unmetered networks. Use Android's NetworkCapabilities::getCapabilities() and NET_CAPABILITY_NOT_METERED as the reference, then expose transport-agnostic metered state for mobile data and Wi-Fi; done means scripts can query that state outside scheduled jobs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
api, cli, mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.