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

chamonix

Recognized Contributor
Nov 7, 2008
4,968
19,142
0
Berlin
Good to know. Nice phone. The only problem I have is a battery. It drains 2-3% hourly on idle :(
Hate to see ~60% at the end of working day if I didn't use it much. I just started with this phone but my previous one (Droid X) had an excellent battery life so I never even had a need to use tools like BBS and Wi-Fi was always on at home.

I hope both of your tools together will help me to solve the battery life situation. :)
I'll post in BBS thread in case I wouldn't able to figure out it on my own but if you have some general observations/recommendations on SSIII settings please let me know.


On v. 0.1 app failed to turn Wi-Fi ON when I unlocked phone complaining that it was put OFF by user (and I didn't). Changed sleep policy to "Always" and it still complaining occasionally.
Happy to report that so far v. 0.2 works all the time. :)

---------- Post added at 04:24 PM ---------- Previous post was at 03:37 PM ----------


Just got the same situation again. App failed to return it to On state. Wi-Fi is OFF now. Here is what I see in a log:
2012-07-30 10:15:03 Received Broadcast ACTION_SCREEN_OFF
2012-07-30 10:15:03 scheduleOffAlarm called
2012-07-30 10:15:03 cancelAlarm
2012-07-30 10:15:34 cancelWifiConnectedAlarm
2012-07-30 11:08:30 Received Broadcast ACTION_SCREEN_ON
2012-07-30 11:08:30 cancelAlarm
2012-07-30 11:08:30 scheduleWifiConnectedAlarm called
2012-07-30 11:08:32 Received Broadcast ACTION_USER_PRESENT
2012-07-30 11:08:32 cancelAlarm
2012-07-30 11:08:32 scheduleWifiConnectedAlarm called
2012-07-30 11:09:02 cancelWifiConnectedAlarm

How can I put in a log everything that is on app console?
Not sure what could put Wi-Fi OFF. I'm using Llama to identify that I'm Home and Wi-Fi should be On. Llama still shows I'm Home.
Any idea?
You could post a logcat, it contains the same info and more.
What I'd be interested in:
I assume the case you talk about is at 11:08. Have you enabled Wifi to stay on only if a connection could be established (means your phone has a valid IP) and if yes, did the phone get one (logcat will tell us that). Please also tell me what version you are on.
I have added an issue as it seems that not all actions are in the on-screen log.
Edit: that's issue #5 on github
 
Last edited:

alexinna

Senior Member
Nov 27, 2010
150
56
0
You could post a logcat, it contains the same info and more.
What I'd be interested in:
I assume the case you talk about is at 11:08. Have you enabled Wifi to stay on only if a connection could be established (means your phone has a valid IP) and if yes, did the phone get one (logcat will tell us that). Please also tell me what version you are on.
I have added an issue as it seems that not all actions are in the on-screen log.
Edit: that's issue #5 on github
1. Yes I was referring to 11:08.
2. "Have you enabled Wifi to stay on only if a connection could be established ..." Yes
3. I can't re-create the same situation. v. 0.2
4. logcat for working case attached

My understanding that I don't need Llama any more to manage Wi-Fi On at Home and Off if not. This app will do it for me every time I lock/unlock the screen. In my case I'm only using Wi-Fi at home so no need to check it anywhere else but it's not possible yet until cell location will be implemented. Is this a correct understanding?
 

Attachments

Last edited:

chamonix

Recognized Contributor
Nov 7, 2008
4,968
19,142
0
Berlin
Thank you for the awesome app! I use y5 https://play.google.com/store/apps/details?id=pl.polidea.y5 now but the author stopped the development a year ago. I do hope your app will switch WiFi off when I will go out of the range of my router and switch the module on when I will be back.
The list of planned features is in the first post, please feel free to request more features if you feel that something is missing.
 

yhrn

Senior Member
Mar 25, 2011
527
339
0
Stockholm
Sweet!
Just installed and will give more feedback later. The one thing I know already is that the planned "whitelist AP" feature is a must for me. My home wifi is very battery friendly and I want several scheduled things to happen during the night, e.g. sync Titanium Backup to Dropbox, even if the phone is not plugged in.
 
  • Like
Reactions: chamonix

Edwrib

Senior Member
Sep 22, 2010
427
43
0
Sorry, could you elaborate a little?
I would like to keep my WiFi running faster as possible, without need to be plugged in charger.

Normally I do this with any other app that have wifi-lock, like unified remote, I keep them running while I need WiFi fast with screen off:
 
Last edited:

chamonix

Recognized Contributor
Nov 7, 2008
4,968
19,142
0
Berlin
I would like to keep my WiFi running faster as possible, without need to be plugged in charger.

Normally I do this with any other app that have wifi-lock, like unified remote, I keep them running while I need WiFi fast with screen off:
I will need to investigate on that. I don't understand what a wifi lock can be or how it can be different from a wakelock: either the phone is prevented from sleeping and that is a wakelock or it sleeps and then the cpu is stopped so there is no way any data tranfer can occur. Of course I could add a wakelock to stick even if the phone is unplugged but then I wonder what even should turn if off.
 

Edwrib

Senior Member
Sep 22, 2010
427
43
0
I will need to investigate on that. I don't understand what a wifi lock can be or how it can be different from a wakelock: either the phone is prevented from sleeping and that is a wakelock or it sleeps and then the cpu is stopped so there is no way any data tranfer can occur. Of course I could add a wakelock to stick even if the phone is unplugged but then I wonder what even should turn if off.
Look into this: http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html

Note that WifiLocks cannot override the user-level "Wi-Fi Enabled" setting, nor Airplane Mode. They simply keep the radio from turning off when Wi-Fi is already on but the device is idle.
 
  • Like
Reactions: chamonix

chamonix

Recognized Contributor
Nov 7, 2008
4,968
19,142
0
Berlin
Ok I got it. It makes sense and I will change the wakelock I use currently
Code:
PowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, some-name);
to a Wifilock.

I understand it will be released whenever Wifi is turned off or if the user releases it (I need a botton for that).

Now it brings me to this feature request: https://github.com/asksven/BetterWifiOnOff/issues/2

It would be great if I could detect if there is another WifiLock before turning off Wifi but at least the public API does not allow that. On the other hand looking at http://grepcode.com/file/repository.../4.0.4_r1.2/android/net/wifi/WifiManager.java

I found a member mActiveLockCount that is incremented/decremented when creating/releasing locks. I love reflections and it shouldn't be that hard to read out that private member and decide to set an alarm for checking again and not turn off Wifi straight away. Doing so and assuming the app needing Wifi sticks to the conventions and holds a Wifi lock it won't be interrupted by BetterWifiOnOff.

I hope this makes sense :)
 

Edwrib

Senior Member
Sep 22, 2010
427
43
0
Ok I got it. It makes sense and I will change the wakelock I use currently
Code:
PowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, some-name);
to a Wifilock.

I understand it will be released whenever Wifi is turned off or if the user releases it (I need a botton for that).

Now it brings me to this feature request: https://github.com/asksven/BetterWifiOnOff/issues/2

It would be great if I could detect if there is another WifiLock before turning off Wifi but at least the public API does not allow that. On the other hand looking at http://grepcode.com/file/repository.../4.0.4_r1.2/android/net/wifi/WifiManager.java

I found a member mActiveLockCount that is incremented/decremented when creating/releasing locks. I love reflections and it shouldn't be that hard to read out that private member and decide to set an alarm for checking again and not turn off Wifi straight away. Doing so and assuming the app needing Wifi sticks to the conventions and holds a Wifi lock it won't be interrupted by BetterWifiOnOff.

I hope this makes sense :)
Make sense and anxious to test :)