Tethering data restriction

Post your questions and help other users.

Moderator: Martin

Post Reply
Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Tethering data restriction

Post by Lucy » 15 Dec 2019 11:59

My phone does not have a data restriction on hotspot so im gonna make my own with flow. Before i go ahead, thought id get confirmation on my theory of how to structure the flow.

1. Store bytes to var when a device connects.
2. Either use a sleep or another flow to execute with periodic timer to check bytes transfered again.
3. Subtract first bytes stored by the second check.
4. If total bytes reached or exceeded value then disconnect and switch off hotspot.
5. If value not reached or exceeded then repeat sleep or continue periodic check.
6. Once device is disconnected, (if using periodic timer) disable flow.
Notes. Id guess i will have to store the results to var to add to next results if value was not reached or exceeded in order to get the accurate totals.

This should work just fine yeah?
Im fairly confident i know all the functions and operators, etc.

- Script obviously for vars and calculations
- Sleep (option one)
- Periodic timer (option two)
- Expression
- Set flow state (if using periodic timer)
- set wifi tethering state
- Notification displayed on status bar
(Currently the only way i can detect connected device on hotspot)
- execute flow (if using periodic timer)
- init vars network traffic
That should be about it i think. Lol its different when planning it like this. I usually just build as i go 😂

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Tethering data restriction

Post by Desmanto » 15 Dec 2019 15:29

Yes, approximately that is the concept. Just use periodic timer instead of sleep, it has less wakelock. The starting trigger of enabling the periodic timer flow can be the notification of tethering. The disabling also can be check from the notification. Usually the phone give info about how many device connected.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Tethering data restriction

Post by Lucy » 15 Dec 2019 18:53

Yepyep my thoughts exactly. Thanks🤙

Post Reply