Detecting (un)metered connection state
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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