yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] TaintedByte:
Very interesting results here. I got notifications on time the entire night then at some point it stopped and I had a flood of three additional emails in the morning when I turned the screen on.

Both on the JSS build and the official with the flags toggled to 1. I might just set the bcast filter back to 0 and get out over with.
[Nexus 4 General] ogrillion:
Yeah I was thinking the same thing about just setting the bcast filter to 0.

I didn't really have any noticeable battery issues when I had it that way before
[Nexus 4 General] TaintedByte:
Yeah there's not really going to be a battery destroyer unless there's a LOT of network traffic through WiFi (pretty much public APs). Never noticed a battery hit either. I'm going to revert to that, it should still work in 4.3.

It's interesting to note, however, that the issue IS minimized with gEnableActiveModeOffload and hostArpOffload set to 1. Just at some point it causes the issue to arise again. I could have the screen off the entire day and get notifications then I could shut the screen off and get them 13 minutes late or not until I turn the screen back on.

For me, personally bcast to 0 COMPLETELY fixes the issue, the two flags mentioned above set to 1 MINIMIZE the original issue and with stock (non JSS) or 4.2.2 builds the issue is there at all times.
[Nexus 4 General] philipepi:
Hey guys.. 3 days ago I did not have this problem.. when I lock my screen, wifi doesn't' work.. im reading this topic and those fix ( zip files ) didnt work..

i made a full wipe, and nothing.. changed those 2 lines in /etc/wifi and nothing..

what now ? Sit and cry? :(
[Nexus 4 General] rayiskon:
settings->wifi->advanced

make sure Keep Wi-Fi on during sleep is set to always
[Nexus 4 General] Blockberd:
Dont forget to mention to turn of WiFi optimization. ;)
[Nexus 4 General] Xoib:
In this particular case, this guy want the Wifi optimization unchecked otherwise he will "cry" like he said in his above post.
[Nexus 4 General] Blockberd:
There are 2 options.

1st option is the rule when to keep WiFi active. This is mentioned by rayiskon.

Option 2 is the WiFi optimization which I pointed out.

Dont confuse them. They both may have a negative effect on your notification delivery and WiFi connection overall.
[Nexus 4 General] Xoib:
He said that he have the two flags related to arp set to 1 and it doesn't work for him. So what he has left is not much solutions.
[Nexus 4 General] philipepi:
it is.

I did it too

the funny thing is, 3 days ago, it was normal .. but since yesterday i've got this problem, even with JSS build.

i will try something different here..

i will format system, wipe all caches and use fastboot to reinstall mako jwr
[Nexus 4 General] Xoib:
Which JSS build did you took ? (if not compile by your own)

Also, after the 3 days, still same test conditions ?
[Nexus 4 General] bossflo:
Somebody know what this bcastfilter does? And its impact in battery ?
[Nexus 4 General] philipepi:
I was using this one

http://xdaforums.com/showthread.php?t=2378359

2 days ago was normal, i was using this jss build or JWR66V, changed arp values and everything was okay.. but yesterday and today... i just lock the screen and puff.. nothing appears until i unblock the screen, just press the button and notifications shows up
[Nexus 4 General] DesmoDavid:
No negative impact on the battery. I suggest to use with bcastfix the PNF app! :good:
[Nexus 4 General] Akatosh:
Is this a problem with the 4.3 upgrade? I had fine WiFi on 4.2.2 no problems at all. I don't get any problems with dropping signal but it is painfully slow. With my gnex and nexus 4 next to each other the gnex got 24mbps download whilst the n4 got 0.2mbps when connected to the same WiFi with fill bars. Would flashing the image for 4.2.2/using an older build ROM do the trick?
[Nexus 4 General] humjaba:
Same problem here.
[Nexus 4 General] blablable:
Not fixed for me. When my screen is off more than 20 minutes, wifi turns off until I awake the phone again. Sleep policy is set to Never
[Nexus 4 General] Stryder5:
This thread isn't about speed, but rather losing wifi connectivity or unresponsive wifi during sleep. My wifi speed is fine for the most part. Also running PACman's JSS build and for the past few hours and don't seem to be experiencing the connection issues.
[Nexus 4 General] Blockberd:
What ROM/Kernel are you using and what about WiFi optimization? Have you also checked the mentioned file once? Maybe the patch did not apply properly.

You can also do the change at any given point of time on your own. You only need root + root explorer app such as ES File Explorer.
[Nexus 4 General] blablable:
I was on latest CyanogenMod RC ROM and the problem was there.

3 days ago I flashed to 4.3 stock, locking the phone and unrooting and nothing changed.

So I called Google and they send me a new phone yesterday. I did an OTA 4.3 update, unlocked and rooted the device and the problem was gone. I could have the screen off for more than an hour and wifi still on; but this morning the problem came back again I did nothing weird.

It's really annoying.

I flashed the ARP offload file provided before and I checked the file with root explorer so the flags are =1 but the problem remains.

BTW, I have tested Wifi optimization on and off and same as before...

Edit: I've done a factory reset and now it's working, but i'm gonna test it throughout the weekend. Maybe some app is the cause, idk
[Nexus 4 General] nyijedi:
Are all of you guys actually losing your whole WiFi connection, or are you just losing connection to Google's servers when WiFi is on and the phone has been sleeping for a while (you can tell you've lost connection to Google by the color of the WiFi icon fading rather than completely disappearing). I seem to be having problems with the latter scenario.
[Nexus 4 General] andy o:
It's not about losing wifi altogether either. It's specifically about delayed notifications on Wifi. In fact most (all?) of us who are having this specific problem aren't losing Wifi connectivity at all, the notifications arrive eventually, seconds or even minutes after they should have, but they ultimately arrive.
[Nexus 4 General] Stryder5:
I'm sorry, I wasn't clear. You are correct. I meant you don't lose your wifi connection, but rather there doesn't seem to be any data transmitted while the phone is asleep. That is why I (poorly) chose the word connectivity.

Anyways, PAC's latest alpha 4.3 build has the recommended changes default to the INI file already so wifi works great for me. I used to have to manually change the files myself.
[Nexus 4 General] Rizy7:
Just giving my input.. I upgraded to stock 4.3 and turned off optimisation straight away. While on stock 4.3 I cant remember ever thinking oh this message was delayed. I was eager to use a jss build as the wifi problem is reportedly fixed. However, on the jss build with wifi optimisation on I occasionally get delayed notifications. However, the delayed notification do not seem to be the same as before as I have not noticed the greyed out bars yet. Has anyone got any method of testing if my notifications are delayed or not. I am currently just looking at if a notification arrives as soon as I wake my phone and also checking the time with the actual message time in whatsapp
[Nexus 4 General] ogrillion:
I was checking delayed notifications by using a dummy Gmail account I use for spam.

Also you can load command prompt in windows and ping your phone to see if it responds.

Oddly enough I had ping responses but delayed Google hang out messages. Still haven't figured out why lol, but I turned multifilter to 0 and now no delay at all.
[Nexus 4 General] DesmoDavid:
If you use Android 4.3 jss firmware just go in System/etc/wifi and edit WCNSS_qcom_cfg.ini and set bcast/mcast filter to 0 (zero). If you want install also PNF from market. Works 110% for me! ;)

From Nexus2²
[Nexus 4 General] Salty Wagyu:
Why are you using PNF if you've edited the WCNSS_qcom_cfg.ini file?
[Nexus 4 General] DesmoDavid:
I wrote "if you want". :D

I use them since long time ago and there is no problem. ;)
[Nexus 4 General] Blockberd:
PNF keeps the timeouts low so that its more unlikely to lose contact to your connection (wifi and cellular). Some provider keep a very short timeout so that delayed notifications could occure even on cellular.
[Nexus 4 General] Rizy7:
For some reason while pinging my device on the latest 3.95 jss pa rom, I get device host unreachable on the first packet but then the other 3 send and receive just fine. Don't know whether it makes a huge difference or not.
[Nexus 4 General] philipepi:
can set up less than 1 minute ( critical ) with pnf? or there is another app that does in less time? Or its better to put 5 minutes, like they recommend ??

I'm using Advance WifiLock Free ( https://play.google.com/store/apps/details?id=opotech.advancedwifilockfree )

and notifications arrive right on time, but i think he drain more battery than usual..
[Nexus 4 General] _Tallis_:
I'm also having the delayed notification issue, had it with stock 4.2, AOKP 4.2 and also have it with PA 4.3 now.

Editing the WCNSS_qcom_cfg.ini file doesn't help, I have to use PNF. So not everyone has a choice. ;)
[Nexus 4 General] Dark Emotion:
I got my Nexus 4 yesterday and I have already noticed some wi-fi problems. If I leave wi-fi on and the phone goes to sleep, when I unlock the phone wi-fi icon is blue but connection is lost. I have Gigaset SX-763 WLAN router. Didn't try and fix yet.

P.S. I am using 4.3 stock
[Nexus 4 General] philipepi:
yes man, this is a pain in the ass

i'm using this app

https://play.google.com/store/apps/details?id=opotech.advancedwifilockfree&hl=pt_BR

idk yet how much battery this app drain, i think its not too much,

the only thing that i dont like is the icon on notification bar stays always there, is there any way to hide this? any app who hide app from notification bar that you dont want to see?

edit: i think i found one

https://play.google.com/store/apps/details?id=com.aboutmycode.NotificationsOff
[Nexus 4 General] Blockberd:
Actually AWL drains alot as it keeps WiFi constantly awake. You may wanna disable it.
[Nexus 4 General] philipepi:
but it seems the one who really works. that PNF took too much to notice me when i have whatsapp or fb msg...

do you know another app like those?
[Nexus 4 General] Dark Emotion:
I am actually testing it now with Wi-fi optimisation set to off. I will see how it will perform in the next couple of days.
[Nexus 4 General] Blockberd:
If you are running 4.3 you may want to edit the mentioned WiFi ini file and set both flags to 1. You can also enable WiFi optimization, disable AWL and use PNF only to set the recommended timeouts.

This is at least the way how I got rid of this damn problem...

OT:

And today I discovered that 4.3 broke the GPS.
[Nexus 4 General] bombadier:
How ?
[Nexus 4 General] philipepi:
i did.. i've tried different, came back to 4.2.2, changed the qcom settings ( arp, etc.. ) tried PA rom, jarjar rom, stock rom, stock kernel, franco kernel, matrix, semaphore, tried alot of things.. i think my problem is my router ( Linksys WRT54g )

with PNF, what interval did you set up? 1 minute? 5 minute ? if someone sends to you a message, how much time will appears for you? have you tested with another phone? here i tried, sometimes message arrives about 1 minute an sometimes about 5 or 6 minutes.. its very annoying .. i mean, when im chatting with someone and i lock my phone for, i dont know if they answered .. i have to press the button..

with awl hes drain my battery, but right now i'm on 36% left and 13hrs out of power..
[Nexus 4 General] philipepi:
thanks man

after a looong trip, testing soo many roms and fixs..

changing genablebmps to 0 solved my problem

now i dont have delay on my notifications.
[Nexus 4 General] Xoib:
Same as putting Wifi optimization unchecked, kinda.
[Nexus 4 General] philipepi:
really? When i uncheck wifi optimization, nothing happens.. same issues,

i will try later heheh

thanks for advice
[Nexus 4 General] andy o:
So, installed CM 10.2. Even though it's based on the JSS build, the flags are set to 0. Seems to be working though, but only from a quick check, maybe I'll have problems later. I still cannot ping the phone with screen off.

---------- Post added at 10:05 AM ---------- Previous post was at 09:34 AM ----------

So I just changed the flags to 1, and apparently the phone can be pinged now. But I got delayed notifications. Still unreliable IMO, but I'll be testing more throughout the day.
[Nexus 4 General] andy o:
So after a day's use, nothing's changed. Still get delayed notifications both with the flags off or on, and wifi optimization also doesn't do much about it.
[Nexus 4 General] Joloxx9:
4.3 came and they still didn't fix it, no matter which build, jwr or jss or arp set to on or off, my notifications are always late, atleast wifi is not disconnecting while screen is off.

I fund workaround how to fix it, in my case turning off wifi optimalization help but can anybody tell me how bug will be difference in battery life if I set it to off. Thx

Wysłane z mojego Nexus 4 za pomocą Tapatalk 4
[Nexus 4 General] Emama:
There are so many "fix"...

So what is the one that can fix the notification delay without killing the battery

Thx
[Nexus 4 General] fozzie:
There isn't one. If there was, you wouldn't have different people reporting different issues, different solutions and different success rates.
[Nexus 4 General] klickig:
made a test today with airdroid and CM-10.2 and the known flags set to 1. tried to transfer data to the phone via wlan. as soon as the display turns off, no chance to transfer data via wlan. this is so annoying. why google why?
[Nexus 4 General] Xoib:
Btw to add others solutions to the list :

I played around with DTIM interval and found that changing gEnableModulatedDTIM between 1 to 4 and setting on/off enableBeaconEarlyTermination has been very helpful to erase the problem and keeping the wifi optimization on.
[Nexus 4 General] Blockberd:
I was able to go from build ...N to ...V and also from ...V to ...Y.

For everyone interested:

The build Y has hit the road. Check it out http://xdaforums.com/showthread.php?t=2413535

I am now going to test the WiFi bug with both flags set to 0 (they are 0 by default in Y, too). I also run 4.3 ...Y stock rooted only. WiFi optimization is on right now.

Let's see how it performs.
[Nexus 4 General] Blockberd:
Ok. Still I require to set the flags to 1 to leave WiFi optimization on and still receive notifications while my phone takes a nap... Damn Google!
[Nexus 4 General] Xoib:
The purpose of this patch was not to fix this bug. So yes in my case (my french router) I still have to have the flags set to 1 // wifi optimization off // PNF 1min.
[Nexus 4 General] philipepi:
So, are you saying that JWR66Y still have problem with delayed notifications?

:(
[Nexus 4 General] Blockberd:
Yes. As [MENTION=5144521]Xoib[/MENTION] pointed out the Y build only focus on security fixes. I did not know the complete changelog of that build when I flased Y and posted here.

So it is obvious that the problem still exists. I hope that the HTC One Mini gets available soon for a decent price here in Germany.
[Nexus 4 General] nowster:
This week's update doesn't touch the kernel which is where the wifi driver problem is.
[Nexus 4 General] Salty Wagyu:
Is it true that not every Nexus 4 is affected? My revision is 301K. Some claim they don't get this issue, giving me good enough reason to try and get an RMA through LG's website and hopefully get a working replacement.
[Nexus 4 General] dancom96:
My phone is 304k and I do not have the bug with ARP offload disabled. When ARP offload is enabled my wifi does not work after sleep.
[Nexus 4 General] Blockberd:
It highly depends on the infrastructure/other devices/other WiFi networks... basically on the whole environment.

Since now nobody mentioned this problem exists only for a few revisions. It mainly looks like a firmware issue. Hopefully it will be fixed soon. Otherwise I am gonna change my phone.

With "disabled" you mean ARP offload set to 0? That would be kinda strange as this is creating exactly this issue for everyone else.
[Nexus 4 General] dancom96:
Yes, ARP offload is set to 0.

It was enabled for a short while during the early nightlies of CM10.2, but after it was disabled I would have issues if I manually enabled it.
[Nexus 4 General] andy o:
CM 10.2 official never had it enabled, and fwiw, I'm not having problems when enabling it myself. Been using faux kernel though. Even when enabled I get delayed notifications at home. Not tested at work very thoroughly.
[Nexus 4 General] raz123:
Were you able to get your Nexus 4 to reliably wake up on WiFi ARP packets? If so, please add what worked for you!

Here: https://docs.google.com/spreadsheet/ccc?key=0AojC3rI3QV8mdGt6Z2J6UWpzSWdNOXlIdE9xMnR0WGc&usp=sharing
[Nexus 4 General] dancom96:
Yeah, it was never enabled in the official nightlies but it was in the unofficial nightlies up until the first official nightly.
[Nexus 4 General] PhilipL:
Hi

I've made the following changes to the WCNSS_qcom_cfg.ini file which so far is working okay and notifications are no longer delayed, for me anyway with power saving still enabled in settings. I tried just the offload settings to 1 but it didn't always help with delays.

# Flag to enable Active mode offload
gEnableActiveModeOffload=1

# Flag to enable HostARPOffload feature or not
hostArpOffload=1

# WMM Enable/Disable
WmmIsEnabled=1

#Data Inactivity Timeout when in powersave (in ms)
gDataInactivityTimeout=200

The changes made that are different are the WmmIsEnabled to 1 and the new entry gDataInactivityTimeout.

A flashable Zip is attached with these settings if anyone wants to give it a go.

Regards

Phil
[Nexus 4 General] Dark Emotion:
I will try when I come home from work. What about wifi optimisation.?
[Nexus 4 General] PhilipL:
Hi

Wi-Fi optimisation is On. The 'gDataInactivityTimeout=200' is spoken about in the Development forum, although I found it independently after browsing around the AOSP source code, so apologies if this has been tried before here for this problem and was found not to have helped.

Wmm is Wireless Multi-media extensions which includes various power saving options, see http://en.wikipedia.org/wiki/Wireless_Multimedia_Extensions. I also have this enabled on my Access Point.

So with these settings in my case at least notifications are never delayed on Wi-Fi, but this could be very Access Point dependant.

Regards

Phil
[Nexus 4 General] Xoib:
I also played around these parameters. Also, have a look to these ones.
[Nexus 4 General] sorcio91:
Thank you for the zip, i'm testing it with PA 3.99 :good:
[Nexus 4 General] Kaanu74:
If you this fix works send them to Paul Wilcox. It reports issue and fixes to the Google developers.

Sent from my Nexus 4
[Nexus 4 General] Xoib:
In 78 pages, there have been multiple "fix" so don't be in a hurry ;)
[Nexus 4 General] PhilipL:
Hi

I'm not sure the issue responding to pings or broadcast traffic can have anything to do with Google notifications directly. Google doesn't ping the phone, and 99.999% of phones will not be pingable by Google anyway as they will be behind a NAT. Google notifications do not use pings or any other broadcast system to send you notifications. It is more likely that without being pingable the Wi-Fi connection is entering a much lower power state and some Wi-Fi points might be failing to support that correctly, or your Firewall/router is aggressively managing any open connections if your phone isn't responding to basic network chatter and so shutting down the open TCP connection between your phone and Googles servers.

I've got my phone here on my Wi-Fi and can't ping it as it is asleep but it is receiving notifications promptly and as quickly as a Nexus 7 sat next to it. I've just received a notification and immediately tried to ping my phone and it still doesn't respond to pings even though it just notified me of new mail.

So while enabling pings might appear to fix the issue in some cases, that doesn't make it the cause of the problem.

Is the OP getting the problem with all Wi-Fi access points or just one or two?

Also Google Cloud Messaging is adaptive so random things can seem to happen with delays etc, making it very difficult to test. Due to the way it works it can take an hour or so before the phone will respond to notifications immediately from Google as it has to learn the time-out values for open TCP connections and typically 15 minutes is the starting point. If you have TCP connections being force-ably closed on your network after say just 30 seconds or so, then initially it may take 15 minutes to see a notification arrive.

Now imagine your Nexus 7 or other Android device never leaves your home, it will have had plenty of time to learn your networks time out values, however your phone when you arrive home switches to your Wi-Fi network will start with the default time-out. This is why you may find other devices in your home notify you immediately, but your phone seems more flaky, and so you think you have a problem with notifications on your phone but in reality it's working fine but just needs time to learn your networks time out values. Ideally your Wi-Fi point, router/firewall should have a high TCP connection time out value of 15 minutes, this saves battery power and means your phone doesn't need to start learning and reducing it's wake cycles to check the connection and notifications start working reliably the moment the phone hits your network.

Regards

Phil
[Nexus 4 General] _Tallis_:
Since I had the described bug (wifi turning blue-grey-blue after activating the screen and delayed notifications), I applied the fix. Hopefully it will work. :)
[Nexus 4 General] floepie:
Fixed! And no "fix" is needed at all for those running a dd-wrt router. Perhaps you guys already knew this, but port 5228 is the magic port that establishes connections with Google's servers and is renewed every 15 minutes. To confirm, I've been studying port logs on my dd-wrt router. Previously, I had TCP timeouts set to only 120 seconds. So, naturally, this connection would die after 2 minutes, only to be restored 15 minutes later, and then only for an additional 2 minutes. So, by lengthening the TCP timeout to a value greater than 900 seconds, I now have emails that arrive at the very moment they arrive on the PC.

For those running DD-WRT, these values can be found at the bottom of the 'administration' tab. Interestingly, 3600 is the default TCP timeout, but I had reduced this timeout to 120 seconds a while back. I've left the UDP timeout at its default value of 120 seconds.

To confirm, the device is now using the default file (using less battery), is NOT ping-able, and is receiving emails on time, and no blue-gray icon switching after turning the device on!
[Nexus 4 General] mobilehavoc:
Are people using a value of 1 or 0 in the config? I have it set to 0 right now but might change it to 1 if it still works and saves battery
[Nexus 4 General] danielvc:
Doesn't work on mine. The fix from the OP works though, so no biggie.

Maybe the OP kan enlighten us?
[Nexus 4 General] defnz:
The good news is https://code.google.com/p/android/issues/detail?id=40065 has been assigned an owner