yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] Xoib:
If only Iliyan Malchev could pass by this thread...

Anyway between Jun 19 and Jul 10, they play around with the ARP flag in the wifi config files. I will have a look later.

WCNSS_cfg.dat | Bin 10138 -> 10298 bytes

WCNSS_qcom_cfg.ini | 14 ++++++++++++--

WCNSS_qcom_wlan_nv.bin | Bin 29776 -> 29776 bytes
[Nexus 4 General] zdenoh1975:
I dont understand this fix, because I used for one week 4.3 leaked and now two days 4.3 oficial, and it was absolutly no difference in behavior on this wifi issue - When was wifi optimisation ON, i had this issue (wifi sleep delayed notification), when was optimisation off - all OK....

So..., now, on official 4.3 rooted, I turned off w.optimisation and this issue is fixed for me, but NOW - do you mean I should turn on wifi optimisation, then flash with TWRP this bganley file and all will be also OK even with stronger battery life??? Thanks!
[Nexus 4 General] andy o:
That's about right.
[Nexus 4 General] fkloznica:
this fix didn't help me.. after 10 min of deep sleep i lost connection to google services.. this is mine third nexus 4 btw :)
[Nexus 4 General] MasterJam882:
Losing the connection to Google Servers is normal behavior I think but messages are received just fine. at least in my case.

Gesendet von meinem Nexus 4 mit Tapatalk 2
[Nexus 4 General] Kaanu74:
4.3, wifi opt. off, still delayed...
[Nexus 4 General] Salty Wagyu:
Good way to self-test if notifications are delayed is to use the Pushbullet app, then send a note from your browser on PC www.pushbullet.com

Messages sent to device is instantaneous

https://play.google.com/store/apps/details?id=com.pushbullet.android
[Nexus 4 General] joshuab227:
On the jss build with WiFi optimization on , tune in radio disconnects after the screen is off for a few seconds and on switching the screen on resumes.

The same also happens in winamps streamcast.

Disabling WiFi optimization fixes it though.

Sent from my Nexus 4
[Nexus 4 General] Kaanu74:
if i after doing this can i re-lock bootloader and can i get the ota when it arrives?
[Nexus 4 General] jeffwei8:
Other users had reported that turning wifi optimization OFF will fix the issue. I never extensively tested that since I did not like the battery drain with it off. For the few minutes I tested it, it seemed to work.

Flashing the file bganley posted changes the two flags in wcnss_qcom_cfg.ini so you don't need to edit it yourself manually with root explorer. It's a cleaner way of doing it. Whether you toggle wifi optimization on/off before or after you flash it shouldn't make a difference. What's important is that it SHOULD allow you to leave wifi optimization ON (therefore better battery life) and still receive push notifications on screen-off.

How about if you apply the fix and leave wifi optimization ON?

Interesting. I haven't had a chance to try a JSS build yet. If you look at the wcnss_qcom_cfg.ini file, are the two flags set to =1?

I'm not sure about that. My impression was that none of the files in the system folder can be removed or added or else OTA will fail. Why not just wait for the OTA to hit and then flash the file (or manually apply the fix) and see if it works first. Then re-lock bootloader after if all is well?
[Nexus 4 General] Blockberd:
So guys. Till now I can confirm that it is working for me now. Advanced WiFi Lock disabled (frozen), 4.3 leak, root and WiFi optimization off. I receive my notifications right in time even while screen is off.

It also looks like the Bluetooth issue is solved, too.

Will try with WiFi optimization on now just for the sake of testing.
[Nexus 4 General] Kaanu74:
I'm not good at this flash and root etc. :silly: Because it will delete all my apps, settings. By the way i tried optimization on still delayed. I don't know why wifi is not fixed on everyone.
[Nexus 4 General] joshuab227:
Yes , both the flags are set to 1.

Its weird but after I flashed the new radio (.84) , tune in seems to be playing properly with the screen off now.

I guess it was a false alarm.

I'm sure this is a coincidence as the radio has nothing to do with the wifi.

Maybe a reboot fixed my problem

Also airdroid lets me transfer files now with my screen off.

And pinging my phone is successful as well with almost no dropped packets.
[Nexus 4 General] rancatoco:
The Bluetooth issue has been solved too, im comfirmed. I'm listening to music by streaming with google play music in Bluetooth headset to two hours and wifi did not fall once!
[Nexus 4 General] Blockberd:
Looks like that as I am using the leak version the both flags in question are already set to 1 (crosschecked to confirm) and therefor I can even turn WiFi optimization on without any issues now.

If there are problems coming up the next days I will let you know. Till then: Problem solved for me. Finally.

BTW:

My Bluetooth issue was that sometimes Bluetooth is not turning on properly and I have to reboot the device to get it on.
[Nexus 4 General] zdenoh1975:
But..,after a few days experience:

I have wi-fi optimisation off (off course issue solved) - and my battery life on wifi is awesome! I never had this strong battery life. (with heavy using, all push services on, bt on...simply my normal using) and screen time on average 5,5 - 6 ours! I never reached such numbers..

I doubt very much, with wifi optimisation on, and using this fix, it can be with battery life even better...

Also, I doubt, that "wifi opmisation off" has any effect on battery life...

So.., why using this fix (at least for me)..
[Nexus 4 General] Fatherboard:
Do you guys leave "Scanning Always Available" checked? It's checked by default to those who did clean install.
[Nexus 4 General] rayiskon:
Exactly the case with me, with wifi optimisations OFF i'm still getting better battery life on 4.3. I also don't think it makes a big difference concerning battery life, but turning it off obviously fixes some wifi problems. So whether we'll call it a workaround or a fix, it doesn't matter to me, i'll be keeping wifi optimisations off..
[Nexus 4 General] Kaanu74:
Wi-fi optimization off doesn't fix my notification problem :mad: can anyone help me?
[Nexus 4 General] Fatherboard:
Anyone?...
[Nexus 4 General] Blockberd:
I upgraded from 4.2.2 stock to 4.3 stock leak and it is not checked for me.
[Nexus 4 General] supersain08:
Hey how do you apply that fix manually. I dint want to flash it. Where are those files located if I am using esfileexplorer.
[Nexus 4 General] archibald_schlick:
You find the .ini in /system/etc/wifi/
[Nexus 4 General] burdo:
4.3 didnt solve the issue. Either on wifi or 3G.

The REGPON wifi keepalive app solved it for wifi.

No luck over 3g/2G.
[Nexus 4 General] Alexandre83:
Works perfect for me.
[Nexus 4 General] andy o:
You're having a different issue, this issue only happens on Wi-Fi.
[Nexus 4 General] TaintedByte:
Okay so I discovered something very interesting today when I received my new Nexus 7. Now keep in mind that the Nexus 4 and the Nexus 7 (2013) both use the same Wi-Fi chip (WCN3660) and CPU. I opened up the WCNSS_qcom_cfg.ini on my N7 and this is what I found:

That is how the tablet ships. Stock, I did not alter anything. So for some reason Google purposely switched those flags back to 0 on the Nexus 4. On the N7 with WiFi Opt ON and the stock flags at 1 I get notifications instantaneously just like I do on my Nexus 4 with WiFi Opt OFF.

I did try the fix on the N4 by switching those 0s to 1s but it only worked for a while and notifications ceased to come in (until I either woke up the device or pinged it, which at least pinging works not as it didn't before). Now that I have established a base with WiFi opt off and how it works I will give the fix another shot and see if it works.
[Nexus 4 General] Kaanu74:
I do like this but doesnt work on my N4. I wait 10 minutes and send a message on Whatsapp, notification recieved same time. But i tried again 10 minutes later notifications delayed. Maybe it's a hardware problem.
[Nexus 4 General] Richieboy67:
I have never had these issues with WiFi slow downs and I don't use those particular spots but how do you his know the issue isn't with those apps?

Also, I think these WiFi issues are effecting a small number of people so it may not be a huge priority. Not sure.
[Nexus 4 General] Dynamole:
I changed 0's to 1 on my Nexus 4. But It didn't work. Notifications still delaying. I hate it, I hate it, I hate it.
[Nexus 4 General] rancatoco:
Hi, I found that when the smartphone is charging notifications always work correctly.

Now ask the teachers>>> there are some configuration parameters that differentiate the functioning of wifi when loading?
[Nexus 4 General] war1:
wifi-delay-fix

Test this wifi-delay-fix-for-jwr66v.
[Nexus 4 General] rancatoco:
I had already changed the flags to 1

Does not work for me.
[Nexus 4 General] Kaanu74:
I think it's a hardware problem. I have 301k. Maybe it was fix on new products. (ex. 303k, 304k) Because this delay doesn't affect everyone.
[Nexus 4 General] rancatoco:
I have 304b rev. 11
[Nexus 4 General] Blockberd:
How do u identify the revision?
[Nexus 4 General] Timo_SGS2:
That is because the phone is always awake while charging. No Deep sleep, no issues wit delayed notifications :)
[Nexus 4 General] rancatoco:
In bootloader

Man, this is already making me very angry, all smartphones I've used receive notifications even after hours with the screen off.

But the nexus 4 is there, silent sleeping while people talk to me in watsup! Emails did not arrive with the screen off!
[Nexus 4 General] Whyzor:
It appears there is a slight benefit to turning Wifi Optimization on still, even though it may be negligible from most user's standpoint:

http://xdaforums.com/showpost.php?p=43953345&postcount=609

Wifi optimization increases DTIM interval:

http://browse.feedreader.com/c/w3techie/414482324
[Nexus 4 General] acid74:
Wifi optimatisation makes things from bad to worse.:)
[Nexus 4 General] Xoib:
Let it ON and stop making sentence who doesn't make sense.
[Nexus 4 General] Dynamole:
Didn't work for me :(
[Nexus 4 General] war1:
sorry, for me it works perfectly.
[Nexus 4 General] neuroval:
Made the changes to the config file, wifi optimization on, works great with no more delayed notifications
[Nexus 4 General] Blockberd:
Same here!
[Nexus 4 General] rxnelson:
Are you turning off mobile data to test this? I couldn't ping my device after sleep but pushbullet received a notification immediately.... (Haven't applied fixes yet.)
[Nexus 4 General] gobbmeister:
Is it possible to flash a custom recovery, flash the fix to allow fixed notification delay with WiFi Optimisation enabled, then flash stock recovery back? I'd like to run Sky Go which will not work on rooted handsets.

So in short, is there a way to fix the notification delay but remain on 100% stock?

Fastboot boot a custom recovery, then make the changes to the WiFi config, then reboot? Will the changes apply and I'll remain on stock everything?
[Nexus 4 General] andy o:
You can just run the custom recovery and the non rooted stock Android. I even have a nandroid backup of stock for testing that I can switch to back and forth with CM.
[Nexus 4 General] gobbmeister:
And I'll be able to flash the WiFi fix and Sky Go will continue to work?
[Nexus 4 General] andy o:
Pretty sure that's correct. You only need root to modify the file from within Android. If you're running stock, you could just install the JSS build, it's supposed to be newer.
[Nexus 4 General] gobbmeister:
Where would I download that from? Think I'll install custom recovery and flash a fix, hopefully Sky Go will still work. Just gotta find a flashable zip that fixes the WiFi Optimisation glitch!
[Nexus 4 General] andy o:
You need to download the image from the AOSP page, it should be easy enough if you're willing to install from scratch, I'm not sure if you can dirty flash it over the OTA stock. The easiest thing for this particular problem in your case is to flash the zip though. I thought you already had it, I think it was made by someone in this thread, look back a bit.
[Nexus 4 General] ata1918:
Why don't you just root and temp unroot from the SuperSU app if neccesary?
[Nexus 4 General] andy o:
Sorry, disregard my last post. You'd actually have to build it from AOSP. Got the factory image and the AOSP confused. The factory images only have the OTA build.
[Nexus 4 General] gobbmeister:
Tried this a handful of times and Sky Go would not work with temp unroot.
[Nexus 4 General] gpsnewbee:
For the ones still having problems with this issue, this are the current settings of my phone and it seems to be working ok.

Try. It shouldn't hurt.

1) change gEnableActiveModeOffload AND hostARPOffload in the wcnss_qcom_cfg.ini file to =1

2) install Push Notification Fixer from playstore and set heartbeat to 1 minute (without this it was not working for me)

In my case WiFi optimization On or Off does not appear to make any difference. You should try manipulating that anyway.

I'm no expert, I'm just a reader of the forum, so I'm just saying this based on personal experience.

I don't know if using this setting will cause battery drain, but since I'm not a heavy user, it's working fine for me.

Hope it helps.
[Nexus 4 General] rancatoco:
And not just with notifications, if I put the phone in your pocket and wait about 5 minutes I do not receive video calls on Skype, Tango

The phone just sleeps.

Now see if is right. I have to be in phone using with the screen turned on to receive video calls and notifications.

This is absurd, unacceptable. and has been dragging on for 9 months and nothing google did not even talk about it!!
[Nexus 4 General] sayogs:
what is the issue actually i am not facing can somebody help me to find the issue easily on my gnex4

Sent from my Nexus 4
[Nexus 4 General] Blockberd:
If you dont face any issue then you are lucky. If you dont know what the issue is, i would refer you to the first post where everything is described by the op.

Another thing:

When i change the 2 flags in the ini file (and i have to) then android is telling me about an 3.4mb update. If i install this it overwrites the ini file. I can reproduce this behavior.

Is there a setting to stop android from checking for updates or a way to stop android from "thinking" that an update is required?

I run stock 4.3 leak with root. Thats all.
[Nexus 4 General] thracemerin:
There's an update because you're running the leak, update to the official OTA and it will stop.
[Nexus 4 General] Blockberd:
I run the update process already once but after changing the flags to 1 again the update process asked me to update. :(
[Nexus 4 General] PhilipL:
Hi

This sounds like a different issue regarding TCP timeouts rather than a Wi-Fi issue.

Push notifications is a bit of a hack by keeping open TCP connections. The device makes an assumption the connection will not time out for 10 or 15 minutes initially.

Depending on the network we use, TCP connection time-outs may be a matter of minutes or less, and it takes the device a while to find the optimum interval between waking and re-establishing the connection just before it times-out. This is why notifications are sometimes delayed, because the connection timed out at 2 minutes so Google couldn't push anything, but the device doesn't wake to check this for many minutes after, when it wakes to find the connection closed it immediately goes off and checks if any notifications missed, then re-estabishles another connection to leave hanging but for a few minutes less. Eventually it works out the optimum time between waking for that particular network. The act of turning off then on Wi-Fi or connecting to a different access point, things we may do while troubleshooting, resets the counter and the delays can return until the device adapts. Some networks may have routers that change the time-outs depending on if they are running out of resources so it can be a moving goal post.

If a network is terminating TCP connections after just a few minutes, the phone eventually works this out and wakes every few minutes to re-establish a new connection, this then uses more power.

Because of the phone dynamically adjusting, this often gives rise to the complaint that our old phone we hardly use or a tablet that has been sat all day on a single Wi-Fi network at home receives immediate notifications (because it has had plenty of time to adjust to the network TCP timeout values), but we've arrived home with our Nexus 4 (or other phone) to find notifications are delayed. This is because the phone simply hasn't had time to adjust time-outs. It also means people can have completely different experiences with push notifications.

The application mentioned above is basically forcing the device to treat the network as a worse case for really short TCP time outs, this may mean on some networks it causes higher power consumption because it is waking every minute, but may not need to wake anywhere near as often as that.

3G networks seem to work much better with notifications and are more consistent. This is because the phone companies want to minimise unnecessary chatter on their network and the overheads of opening and closing connections. A large percentage of constant background traffic and TCP connection requests will be to Google Services from Android devices. So their networks recognise open connections back to Google servers and so keep them open for the maximum time possible, this stops a lot of chatter with phones constantly having to wake and re-establish connections, and their subscribers get better battery life.

Regards

Phil
[Nexus 4 General] rancatoco:
Wooow, very good explanation!!

But just wanted to know why the nexus delayed notifications, all other smartphones there home work smoothly, receive real-time notifications no matter how long they are deep sleep
[Nexus 4 General] ogrillion:
Wanted to throw this out there..

Good Evening,

I work nights and spend a good chunk of the night testing the delayed notifications on my phone. When 4.3 leaked I did flash it and was amazed to see my notifications came instantly when the screen was off..

Then I flashed factory images from google and never even bothered to test the notification issue figuring it was fixed (maybe it was for me idk) But anyways last night I flashed Jarjars AOSP JSS15J and sure enough started noticing delayed notifications. I tried every wifi configuration tweak and nothing worked to fix it (except removing WIFI optimization, which gave a lot of battery drain)

So today I came home and flashed the google faction image ( JWR66V ) and I changed the wifi config file to the 1 and 1 for off activition and arp offload or whatever.. Rebooted, waited a while and pinged my phone - all replyed with 50ms .. And I logged into my other email account and sent google talk messages to my phone and sure enough instant replies..

Now I have to test this at work because this is where I tested it all last night, maybe my work wifi just doesn't work the same as my home network.. (Keep in mind on 4.2.2 I did get delayed notifications at work and at home).

TLDR: Android 4.3 JSS15J vs. JWR66V - more testing needed but for me JWR66V w/ wifi cfg tweaks = no notification delay JSS15J = notification delays unless I turn off WIFI optimization.

On my way to work so I apologize for spelling errors and or grammar problems just wanted to get this out for a few of you guys having issues.

**Edit**

Honestly this phone is a piece of garbage.. No matter what setting or change I have delayed notifications at work on their wifi.. My iphone 4 from like forever ago has instant notifications.. Sigh.. What a disapointment.

** Edit 2 **

I kept playing around with settings and ended up with both wifi config settings at 1.. I pretty much have given up, but then I had a thought maybe google hangout is causing the issue..

So I tried an email - instant notification.. Tried google voice (strictly on WIFI no mobile connection at the moment) and I got the text instant..

Google hangout .. delayed..

VOIP instant ring..

I am stumped. lol..
[Nexus 4 General] sorcio91:
I have the same problem, in JSS15J I still have this annoying issue. I have read somewhere that rising the voltage for the lowest frequency will help a lot. I'm doing another test now, but i will try this too. If you have a custom kernl, try that and let me know!
[Nexus 4 General] Blockberd:
Maybe you try the app Push Notification Fixer from the playstore. This app tackles exactly this issue (basically network timeouts).
[Nexus 4 General] sorcio91:
Yes but it's a "stupid" workaround, this thing should be fixed by Google and the notifications should be instant, like in any other phone.

I won't use an app that wakes my phone up every 2/5 minutes, draining my battery and only shortens the delay.
[Nexus 4 General] Blockberd:
The app does not wake your phone. It simply changes the timeout on the specific network. The app which kept your WiFi connection awake was Advanced WiFi Lock. PNF instead just changes the timeout for each network (cellular or WiFi). It does not even appear in the app list of the battery usage screen!
[Nexus 4 General] sorcio91:
I read that it drains battery and i've tried it some time ago, and like i said it only shortens the delay and don't completely fix it.

First of all i will try anything to get this bug off at 100%, than i will re-try this app. :(
[Nexus 4 General] ogrillion:
No I don't use a custom kernel atm trying to remain mostly stock.

But basically testing tonight with just the wifi cfg changes I get instant email and Google voice text notifications but delayed Google talk.

Google talk can take up to one or two minutes to be received. Very weird. Maybe it's normal for Google talk though honestly never worried about instant push notifications before.

Ty for the description of that app going to try it. I left the mobile timeout android default but dropped the wifi down to ten minutes.

See how that goes
[Nexus 4 General] Xoib:
With the changes of the two flags at 1 :

- No delay notifications at all at the work Wifi (router Cisco)

- Big delay notifications at the home Wifi (router FreeBox v5)

It still better that leaving the flags at 0 and have big notifications delay at both Wifi...

Ah, and for the home Wifi, there is absolutely no change by setting static IP on the phone and setting ARP-MAC fix address on the router !
[Nexus 4 General] sorcio91:
What ROM are you using? JSS15J based or stock?
[Nexus 4 General] Xoib:
Stock JWR66V. But because of the flags change it's like JSS15J.
[Nexus 4 General] Lownita:
So basically there is no fix for this on jss build?
[Nexus 4 General] ogrillion:
It'd strange I was testing my phone at home.

Google talk is basically the only thing I use on my phone none of my friends text. Anyway Google talk has notification delay.

What's odd is when I send a test message to my phone and then ping the phone, the phone responds to pings just fine yet it takes like two minutes for the Google talk message to alert me, unless I turn on the screen.

Email seems mostly instant, and voip instantly wakes phone.

Anyway it's better then 4.2, phone wouldn't respond to pings then and voip wouldn't ring and go to voice mail.

And I think both 4.3 builds probably have this issue since I was at work when I was playing around with the jsst build I couldn't ping my phone. Was strictly going on Google talk.
[Nexus 4 General] gklimov:
It's working

Thanks a lot! That's worked for me!

Actually, I've made these changes manually by editing /system/etc/wifi/WCNSS_QCOM_CFG.ini file and setting

gEnableActiveModeOffload=1
hostArpOffload=1

but I guess flashing this ZIP will do the same. ;)

Symptoms were:

At home wi-fi via ASUS RT-N15 router.

Sites or services with VERY low latency (i.e. google.com) work somehow.

Sites or services with with relatively high latency doesn't work. For examle Blizzard Battle.net Authenticator were syncronizing for several minutes instead of second.

Now everything looks nice.
[Nexus 4 General] :
I used this mod here, and for me it worked perfectly. The notifications arrive at the same time. There is no delay.

http://db.tt/AhFHxxTq

I'm using the rom rasbeanjelly R2.1

Enviado de meu Nexus 4 usando Tapatalk 4