Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,351 Members 41,358 Now Online
XDA Developers Android and Mobile Development Forum

[APP][2.1+][15 Jun - 2.1] Better Wifi on/off

Tip us?
 
chamonix
Old
(Last edited by chamonix; 15th June 2013 at 10:26 PM.) Reason: Release
#1  
chamonix's Avatar
Recognized Contributor - OP
Thanks Meter 13234
Posts: 4,078
Join Date: Nov 2008
Location: Berlin
Smile [APP][2.1+][15 Jun - 2.1] Better Wifi on/off

Better Wifi on/off is the latest creation of project better. It is an agent managing your Wifi state based on heuristics (set of rules).

This app aims at giving you the control of the Wifi state, optimizing your battery life without losing on user experience.

Better Wifi on/off releases are available from Google Play. Development versions will be made available on xda for testing new features / fixes.


The app is free, fully featured with ads.
If you want to support me and/or get rid of the ads you can purchase a "support-the-dev" version on google play.

What is the motivation behind controlling Wifi?
On paper Wifi is less power hungry than 3G but... some apps behave differently when Wifi is on (DropBox / Google+ uploads, Google Maps location caching), the well known wlan_rx kernel wakelock is a symptom of wakeups caused by uncontrolled Wifi hotspots, the Wifi sleep policy is not working consistently and does solve all problems.

Settings to control Wifi
The preferences allow you to control Wifi.

The basic rules for keeping Wifi on / turning Wifi off are (will vary based on your settings):

When device is turned on Wifi stays on if: "network is connected" AND "the access point is whitelisted" && "wifi is not caged (a connection to google.com can be made)"
When screen goes off Wifi stays on if: "phone is in call" OR "network activity was detected" OR "tethering is on" OR "wakelocks from other apps using network were detected"

There are of course plenty of settings to change that behavior like e.g. keep Wifi on if connected to A/C, leave Wifi on as long as connected to a whitelisted SSID.

Sources
This project is open source und the Apache license. Please feel free to browser the repo, review, fork it as you like: https://github.com/asksven/BetterWifiOnOff

Bugs / Feature requests
Open bugs and feature requests can be found on github here: https://github.com/asksven/BetterWifiOnOff/issues

If you want to report a bug you can to it there but also simply post it here, I'll take care of documenting it and reply with the issue number for an easier tracking.

Changelog:
V.2.1
- no changes from RC3

V.2.1RC3
- updated russian translation
- added more logging on detected connected SSIDs

V.2.1RC2
#120: a hopefully better fix for cage check timings
#125: added a pref for leaving wfi on when screen goes off but a connection is active

V.2.1RC1
Added direct link to gplay from main screen

V.2.1B3
#120: start thread for cage check earlier (at wifi on)
Added timed checks
Loading application whitelist is asynchronous

V.2.1B2
#115 threaded cage check
Added more logging to solve the "alarm: null" error
Updated russian language file
Added timestamps to logcat output

V.2.1B1
#115: better cage detection
#116: inconsistent messages when enabling/disabling from the widget
#117: inconsistent plug/unplug event messages
#119: null pointer exception with message alarm: null
Fix for detection support the dev version


Older changelogs
 


V.1.3.0.2
#92: enable/disable messages are shown multiple times and are not consistent to the user events

V.1.3.0.1
#91: Wifi should be turned off when screen is off and whitelisted a/p gets disconnected

V.1.3.0.0 on Google Play
No changes from latest RC
V.2.0
Merged to master

V.2.0RC8
#112: A better fix for donation detection


V.2.0RC7
#112: Fixed donation detection
ActionBar style for pre-ICS phones

V.2.0RC6
#110: fixed CDMA cell collection

V.2.0RC5
#104: added share/save feature
#105: handle CDMA cells
#106: event log on whitelist shows %s instead of real value
#107: added "clear cell log"
#108: null pointer is cellinfo is null
#109: blank SSID causes the A/P to be handled as whitelisted

V.2.0RC4
#103: fixed issue with unfinished database transation
Removed pull-to-refresh as no longer maintained
Optimized dialogs

V.2.0RC3
#11: added cell tower awareness and rule to turn Wifi on only if connected of known cell
#102: app wihtelist does not keep checked apps

V.2.0RC2
#98: add check for whitelisted app: when running Wifi will not be turned off

V.2.0RC1
Uses ActionBarSherlock for same UX on all android versions
Use Pull-to-Refresh to update list
#95: enabling with widget turns wifi on
#96: avoid scheduling wifi off when screen goes off but wifi is off already
#100: preference to select between light and dark theme
Added russian

V.1.3.0.0RC2
#90: wrong message when user disables/enables processing by tapping the widget

V.1.3.0.0RC1
#88: When disregard airplane mode is enabled wifi is not turned on when screen is turned on
#89: disabling / enabling handling based on user action on wifi outside of BWOF should be logged
New readme and rate dialogs

V.1.2.0.0
No change from RC1

V.1.2.0.0RC1
#82: pref to re-enable BWOF when Wifi is turned on manually
#84: conneting power does not respect airplane mode
#85: when pref is undefined turning screen on enables wifi even if this action is set on unlock

V.1.1.1.0
Fixed various FC conditions from logs/gplay dumps

V.1.1.0.1
#83: potential FC when opening preferences

V.1.1
No change. Grab it from Google Play

V.1.1RC2
no changes, done all the merging and prepared for release

V.1.1RC1
#39: advanced pref to connect to best available network
#80: make sure to always cancel pending alarms when screen is turned on
#81: allow to disable Wifi on function completely

V.1.1B3
#77: widget bg is not 100% transparent
#78: screen on/unlock should always make sure that pending alarms for Wifi-off are canceled
#79: losing connection to access point should never cause handling to get disabled, only user turning Wifi off

V.1.1B2
#19: disable processing when user turns Wifi off using the settings
#70: add second URL for cage detection check
#76: fixed API returning quoted SSIDs (bug found on 4.2)
Compiled with new SDK

V.1.1B1
#69: locale/tasker plugin to enable/disable processing
#71: reduce event logging
#73: fixes for french
#74: widget to control processing (enable/disable)
#75: pref to ignore airplane mode and still enable/disable Wifi

V1RC9
#68: fixed cage detection

V1RC8
#67: fixed SQLite exception and missing perm

V1RC7
#65: respect airplane mode for all screen events

V1RC6
#61: fixed event log sorting to DESC
#62: whitelist shows quotes around some SSIDs
#63: inconsistent placement of pref "if plugged" between simple and expert mode prefs
#64: changes in SSID whitelist are not reflected immediately

V1RC5
New fix for not always visible event log (is not persisitent)
Check for turning Wifi off now goes on every 15 minutes instead of stopping after 5 retries (needed for #51)
#51: rule for leaving Wifi on when screen goes off and SSID whitelisted
#57: fixed whitelist detection not working in RC4
#58: fixed whitelist prefs for post-GB devices
#59: encoding in pref for network activity
#60: SSID should show configured and not available SSIDs

V1RC4
#51: added rule to not turn Wifi off when screen goes off but a whitelisted SSID is connected to (pref)
#54: Alarm should go on every 15 minutes in order to disconnect when whitelisted SSID is not connected anymore
#55: respect airplane mode (do nothing if detected)
#56: reordered prefs by rules for leaving wifi on "when screen on" and "when screen off"

V1RC3
#50: Wifi off delay labels were misleading
#52: whitelist is no multi select list on SDK >= 11
#53: do not check wakelocks when wifi is turned off as a result of "leave Wifi on" rules

V1RC2
#49: added perm to read logs (pre JB)

V1RC1
Cleaned up home screen, moved "disable" to (advanced) prefs

V0.10.1
#48: removed 'grep' command from logcat

V0.10
#41, 43: option to save preferences / logcat as debug info
#42: repertoed typos
#44: added simple and expert preferences
#45: removed own logfile

#46: removed not requires prefs: leave on if in call and if tethering are both always handled

V0.9
#40: don't turn Wifi off is Wifi tethering is active
Added german and french translations
V0.8.1
#31: wifi goes off when unplugged but screen is on
#32: calling the app from notification does not show even log
#33, 35: make pref labels consistent
#37: alarm for turning Wifi off should not obcess
Fix for Wakelock detection

V0.8
#36: added wakelock detection to keep Wifi on when background apps (e.g. streaming) are running

V0.7
#29: a delay of 0 skips some checks before turning Wifi off
#30: fixed binder error
Added better network activity detection before turning Wifi off (besides download manager, see preferences)

V0.6.1
#27, #28: added more logging / event logging

V0.6.
Added icons to action bar (ics+)
#17: keep wifi active when screen goes off and downloads are running or queued
#26: keep wifi active when screen goes off and in a call

V0.5.
#20: (another attempt to fix) fast off/on causes Wifi to be turned off be not canceled alarm
#25: editing SSID whitelist causes the correct connection to be re-validated (after the configured timeout)

V0.4.1.0
#21: Wifilock checkbox on main screen is not sticky
#22: Broadcast handler is not allowed to send events to Service
#23: Wifilock pref caused FC
V0.4.0.1
#20: fast off/on causes Wifi to be turned off be not canceled alarm

V0.4.0
#8: Wifilock when connected and permanent
#9: option to stay on only if connected to a whitelisted SSID
#13: add Wifi power management: high perf Wifilock
#15: fixed bug not disabling all functions

V0.3.1
#7: fix for FC condition on punplug

V0.3
#5: not all actions are documented on screen
#6: option to hold wakelock during plugged to prevent the phone from sleeping

V0.2
#1: removed preference "on only if previously on": far too complex to explain
#3: added a preference to disable the handling
#4: preference to leave Wifi on when screen goes off but phone is on charger
V0.1
- initial beta release
Attached Files
File Type: apk BetterWifiOnOff_1.1.1.0.apk - [Click for QR Code] (355.6 KB, 397 views)
File Type: apk BetterWifiOnOff_1.2.0.0.apk - [Click for QR Code] (359.2 KB, 247 views)
File Type: apk BetterWifiOnOff_1.3.0.1.apk - [Click for QR Code] (364.8 KB, 269 views)
File Type: apk BetterWifiOnOff_1.3.0.2.apk - [Click for QR Code] (364.6 KB, 488 views)
File Type: apk BetterWifiOnOff_2.0.0.0.apk - [Click for QR Code] (1.03 MB, 346 views)
File Type: apk BetterWifiOnOff_2.1.0.0B1.apk - [Click for QR Code] (1.03 MB, 281 views)
File Type: apk BetterWifiOnOff_2.1.0.0B2.apk - [Click for QR Code] (1.03 MB, 454 views)
File Type: apk BetterWifiOnOff_2.1.0.0B3.apk - [Click for QR Code] (1.04 MB, 242 views)
File Type: apk BetterWifiOnOff_2.1.0.0RC1.apk - [Click for QR Code] (1.04 MB, 386 views)
File Type: apk BetterWifiOnOff_2.1.0.0RC2.apk - [Click for QR Code] (1.12 MB, 353 views)
File Type: apk BetterWifiOnOff_2.1.0.0RC3.apk - [Click for QR Code] (1.14 MB, 328 views)
File Type: apk BetterWifiOnOff_2.1.0.0.apk - [Click for QR Code] (1.14 MB, 3647 views)
The Following 152 Users Say Thank You to chamonix For This Useful Post: [ Click to Expand ]
 
chamonix
Old
(Last edited by chamonix; 28th July 2012 at 01:12 PM.)
#2  
chamonix's Avatar
Recognized Contributor - OP
Thanks Meter 13234
Posts: 4,078
Join Date: Nov 2008
Location: Berlin
Default How To

How to report a bug
Reporting this or that is not working does not help. This is a development thread and I expect a minimum set of information:
- What version are you using
- What behavior did you expect
- What behavior did you get
- How to reproduce the problem
- a Log
You can report bugs in this thread or on github (see post #1 for links)

How to request a feature
Simply post what you would like to have. If others (and I) like the idea it will be implemented (as long as possible)
The Following 7 Users Say Thank You to chamonix For This Useful Post: [ Click to Expand ]
 
chamonix
Old
(Last edited by chamonix; 1st June 2013 at 08:48 PM.)
#3  
chamonix's Avatar
Recognized Contributor - OP
Thanks Meter 13234
Posts: 4,078
Join Date: Nov 2008
Location: Berlin
Default FAQ

Q: Why would I need an app to control my Wifi state?
A: If you are happy with your settings and your battery life you don't need it

Q: How can I find out if Wifi is draining my battery?
A: Use Better Battery Stats

Q: But Wifi consumes less power than 3G, Why would I want to turn Wifi off?
A: Theoretically true but... Many apps behave differently when Wifi is on, like e.g. Dropbox or Google+ upload features. Besides that the famous wlan_rx kernel wakelocks show that incoming traffic can wake up your phone, causing a lot of overhead. And finally the Wifi sleep policy is not optimal for everyone (if working at all)

Q: Will this app stay free?
A: yes, free with ads but fully featured. There will be a donate version to support me but that version will only remove the ads

Q: Will this app be available on Google Play?
Yes, once out of beta. To be efficient a beta must be limited to a small user group. Besides, psoting feedback in the rating on Google Play is a) lame and b) does not help the devs

Q: Is there a help?
A: No, this app should be self explaining so if you find something unclear please report it as a bug, I'll take care of it.

Q: Why does BWOF disable after a reboot?
A: Certain devices / Android versions seem to have a different handling of turning Wifi off when rebooting, making BWOF believe that Wifi was turned off by user. I have no way of finding out what devices are affected and how to fix this. A workaround is to not enable "Disable when user turns Wifi off".
The Following 5 Users Say Thank You to chamonix For This Useful Post: [ Click to Expand ]
 
s4pat
Old
#4  
Senior Member
Thanks Meter 45
Posts: 107
Join Date: Jul 2010
Thanks, will give it a try.
 
Sincitybronze
Old
#5  
Senior Member
Thanks Meter 41
Posts: 380
Join Date: Aug 2010
Wow, chamonix does it again. You are awesome. Can't wait to see how this works!
 
RovG
Old
#6  
RovG's Avatar
Senior Member
Thanks Meter 153
Posts: 303
Join Date: Jul 2011
Hi Chamonix,

Thank you for another useful creation. :thumbup:

Please can you advise what would happen if wifi is off but mobile data (use packet data) is enabled and an app woke up the device requiring network access? I guess what I am hinting at: will it be possible for this app to disable mobile data as well?


Sent from my GT-I9100 using xda premium
The Following User Says Thank You to RovG For This Useful Post: [ Click to Expand ]
 
Edwrib
Old
(Last edited by Edwrib; 28th July 2012 at 02:52 PM.) Reason: wrong auto correction.
#7  
Senior Member
Thanks Meter 40
Posts: 378
Join Date: Sep 2010
Awesome.
What you think a option to have WiFi_lock with the WiFi on? Many ppl have issues to transfer files via WiFi and speed go down if display turn off, with this added in you app we can control WiFi all in same place.
Ty.
C650>E398>N95>Milestone>SGSII>SGNexus>Xperia ZL
 
chamonix
Old
#8  
chamonix's Avatar
Recognized Contributor - OP
Thanks Meter 13234
Posts: 4,078
Join Date: Nov 2008
Location: Berlin
Quote:
Originally Posted by RovG View Post
Hi Chamonix,

Thank you for another useful creation. :thumbup:

Please can you advise what would happen if wifi is off but mobile data (use packet data) is enabled and an app woke up the device requiring network access? I guess what I am hinting at: will it be possible for this app to disable mobile data as well?


Sent from my GT-I9100 using xda premium
Possible yes but this will never happen!
A) because this app manages wifi and
B) this would cause more drain than anything else as the app would cause partial wakelocks and maybe even wakeups

If you don't want apps to use data select those that have proper settings / implementations
 
suku_patel_22
Old
#9  
suku_patel_22's Avatar
Senior Member
Thanks Meter 746
Posts: 2,163
Join Date: Jun 2011
Location: Mumbai
Well, for the cell based locations, i would suggest to do it based on cell id rather than location provided by network.

Once that is done, this would help me a lot.


HTC One(Stock), Nexus 7(AOSPA/Franco), HTC Desire S(Fallout)
Thanks posts clutter, hit the "Thanks" button instead!
 
john9
Old
#10  
Account currently disabled
Thanks Meter 269
Posts: 1,587
Join Date: Oct 2011
Looks great! I'm about to try.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes