04-15-2013 04:07 AM
66 123
tools
  1. a5cent's Avatar
    Ah coz we're discussing a different thing now. We're now trying to ascertain whether Whatsapp is using it for keeping connection alive (TCP/IP) or WiFi alive. The test case is designed so that the API is not active at that moment (so we know whether or not Whatsapp can indeed use true push rather than poll system).
    Okay, I still think something is fishy, but I'll hope it's just semantics.

    I imagine that it shouldn't be too hard to test what the audio background task is actually doing. Maybe someone can try this (I haven't got my second phone on me, so I can't do this myself):

    Preconditions (for the IM receiving device):

    * Make sure the background audio task is running (launch WhatsApp and then close it again).
    * Disable cellular data.
    * Disable keep WiFi alive.


    Action a) Make sure RX (the receiving device) is active (display on).
    b) Send RX a WhatsApp IM from TX (the sending device).
    Expectation TX notifies that the IM was delivered.
    Explanation This is just to verify that everything is working as expected on RX, and that it has an open connection to the WhatsApp server.








    Continue directly with the tests. Don't open any other apps and particularly don't play any audio.

    Tests:

    Test 1 (is the audio background task keeping WiFi alive and maintaining an open connection to the WhatsApp server?):

    Action a) Wait until RX becomes inactive (display off).
    b) Send RX a WhatsApp IM from TX.
    Expectation TX doesn't notify that the IM was delivered.
    Explanation WiFi was shut down. Since no other data connection is available, nothing is delivered to RX.
    Conclusion The background audio task is not keeping WiFi alive. Continue directly with Test 2









    However, should TX unexpectedly notify that the IM was delivered, then the audio background task is keeping WiFi alive and obviously also maintaining an open connection to the WhatsApp server. No further testing is necessary. The audio background task does both.

    Test 2 (is the audio background task only maintaining an open connection?):

    * Enable cellular data.

    Action a) Make sure RX is active (display on).
    b) Turn off your WiFi access point
    c) Wait a minute or two (likely unnecessary, but just to make sure).
    d) Send RX a WhatsApp IM from TX.
    Expectation TX notifies that the IM was delivered.
    Explanation WiFi was shut down, so the IM was delivered through the cellular network. Reestablishing the connection on the cellular network is what the audio background task is suspected of doing.
    Conclusion In all likelihood it is the audio background task that is re-establishing the connection to the WhatsApp server. To make absolutely certain, verify this by repeating this test as described below.













    * Disable the audio background task

    Repeat Test 2. If it is the audio background task that re-establishes the connection on the cellular network, then the IM will now not be delivered.
    Last edited by a5cent; 04-13-2013 at 04:39 AM. Reason: Spelling
    thegamevg likes this.
    04-11-2013 04:39 PM
  2. a5cent's Avatar
    Let me try and get this straight: OP is mad because Whatsapp doesn't work if you don't have a data-connection?
    No. We want to understand why WhatsApp is misusing the background audio processing feature and causing excessive battery drainage. We want to understand what is actually going on.
    04-11-2013 04:45 PM
  3. Giddora's Avatar
    No. We want to understand why WhatsApp is misusing the background audio processing feature and causing excessive battery drainage. We want to understand what is actually going on.
    To keep Wifi alive in the background on phones where the "Keep Wifi-alive"-feature isn't available.
    JamesDax likes this.
    04-11-2013 05:32 PM
  4. a5cent's Avatar
    To keep Wifi alive in the background on phones where the "Keep Wifi-alive"-feature isn't available.
    That is wrong, because the audio background task also starts up on devices where that feature IS available. At least that is what is being stated (haven't got my 920 on me ATM so can't verify).

    ChMar gave an alternative explanation as to what that task is really doing, which I think makes much more sense.

    I suspect my test case should clarify the issue.
    04-11-2013 06:42 PM
  5. Florin Anghel's Avatar
    That is wrong, because the audio background task also starts up on devices where that feature IS available. At least that is what is being stated (haven't got my 920 on me ATM so can't verify).

    ChMar gave an alternative explanation as to what that task is really doing, which I think makes much more sense.

    I suspect my test case should clarify the issue.
    Not wrong, at least not literally wrong. Whatsapp on WP8 uses audio api because they were lazy to remove it. Without audio api, like I said, you still get notifications on wi-fi while the phone is locked.
    04-11-2013 06:56 PM
  6. ChMar's Avatar
    @a5cent I'll run a battery of tests tomorrow(bed time now) using the phone and a bluestack whatsapp as the sender. And this should clarify the issues.
    04-11-2013 07:00 PM
  7. ttsoldier's Avatar
    That is wrong, because the audio background task also starts up on devices where that feature IS available. At least that is what is being stated (haven't got my 920 on me ATM so can't verify).

    ChMar gave an alternative explanation as to what that task is really doing, which I think makes much more sense.

    I suspect my test case should clarify the issue.
    This is because the whatsapp team is too lazy to make a separate version for WP8 and WP7
    04-11-2013 08:57 PM
  8. a5cent's Avatar
    Not wrong, at least not literally wrong ... Without audio api, like I said, you still get notifications on wi-fi while the phone is locked.
    Yes. I know. I think that statement is wrong nevertheless. If that statement is not wrong, it is at least too incomplete to be useful.

    I suspect you and others aren't quite grasping all the variables at play here. I too have no more time today, but I will attempt to provide my own explanation tomorrow.

    @ChMar, Thx
    04-11-2013 09:04 PM
  9. rockstarzzz's Avatar
    Yes. I know. I think that statement is wrong nevertheless. If that statement is not wrong, it is at least too incomplete to be useful.

    I suspect you and others aren't quite grasping all the variables at play here. I too have no more time today, but I will attempt to provide my own explanation tomorrow.

    @ChMar, Thx
    I might have mmissed it but how do you propose turning off the audio api connection? Restarting phone and no opening whatsapp on RX and then sending a msg after say 20-30 minutes from TX?
    04-12-2013 05:11 AM
  10. a5cent's Avatar
    Okay, I don't know if I can explain this any better than others already have, but I'll give it a shot:

    A few abbreviations:

    IM > instant message
    WA > WhatsApp (the app)
    WAS > WhatsApp server
    MPNS > Microsoft Push Notification Service (a collection of servers and WP APIs which together implement WP's standard for delivering push notifications)

    On iOS and Android, WA IMs are pushed to devices through a single channel:
    • via the WAS

    On WP, developers are expected to use MPNS whenever they need push notification services. For whatever reason(s), the WA team decided they don't like MPNS. As a result, WP's version of WA has two channels through which it can receive data:
    • via the WAS
    • via MPNS

    Now, depending on which channel is used, the way an IM ends up on your WP device is quite different. For now, we'll ignore all those differences. We'll also ignore the question why WA is using two channels instead of just one. The only issues I'll get into are those related to connection management:

    An app that uses MPNS doesn't need to manage its own connection to the MPN servers. WP does this autonomously on behalf of any and all apps that require push services. WP ensures devices can receive push notifications from MPN servers at all times (provided a usable data link exists which isn't disabled in the settings). However, as the WA team apparently prefers their own approach, they must also manage their own connection to their WAS. Managing that connection implies noticing when a connection collapses (e.g. when moving out of range of a WiFi hotspot) and re-establishing that connection on a different data link if possible (e.g. over a cellular data link).

    Obviously, any connection can collapse at any time, so connection monitoring must be a continuous process. This is what we suspect the audio background task of doing. WA can't do this without the background task, because task switching, closing WA, or the device going to sleep would interrupt the monitoring process.

    Given this suspicion, we doubt that the WA owned audio background task persists solely due to developer neglect. I think the test case I wrote has a good chance of clarifying what is really going on. Has anybody been able to try?

    I don't know if that makes things any clearer, but I hope so.

    I might have missed it but how do you propose turning off the audio api connection? Restarting phone and no opening whatsapp on RX and then sending a msg after say 20-30 minutes from TX?
    Some claim that playing audio with MS' audio player shuts down WA's audio background task. I haven't been able to verify this as I don't have my L920 with me at the moment (don't think it makes sense to test this on my L800).

    However, I would do exactly what you said. Restarting the device and not launching WhatsApp is likely the safest bet.
    Last edited by a5cent; 04-13-2013 at 05:52 AM. Reason: spelling
    rockstarzzz likes this.
    04-13-2013 01:48 AM
  11. a5cent's Avatar
    Oh yeah, I won't be getting home until next weekend. Until then I'm without my L920. If anyone else can do these tests earlier I would love to hear the results! :-)
    04-14-2013 04:52 AM
  12. broar94's Avatar
    This causes massive battery drain yes? I keep going to this 'stop the music' app and manually closing music playback. Is this a good approach to avoiding batt drain?
    04-14-2013 04:18 PM
  13. tendoboy1984's Avatar
    I just use my home WiFi network when using chat apps. iOS and Android don't have any problems connecting to chat apps or receiving notifications.
    04-14-2013 10:47 PM
  14. aka P's Avatar
    I suggest it is best you guys wait for the upcoming update for WhatsApp and then arrive at a conclusion. *prettyplease*
    04-15-2013 12:08 AM
  15. ammarmalik2011's Avatar
    @ah06: For an app to be able to stay in the background using the audio api it must first be launched. Push notifications don't require the app to be launched(except once so it can register to the MPNS). On iphone they can stay in background once launched unless user kills it(same on android). On wp8 even with audio bg hack their app might get killed since I can start listening to music and thus kill their app. So they need a fallback. So I guess that their use of push notifications when the app is not in bg is their fallback strategy.

    Let's use Skype, mail and whatsapp as comparison. You do not have an active TCP/IP connection for email. You receive push notifications and then open the app and the app downloads the mails. In the UI you see that the mail is not there yet it is downloading and will appear later. But in a sense you are always online when using mail. Let's look at Skype. It's based on a similar principle even though it is a IM app. You receive the notifications that someone wrote to you. One line of text 10 lines it does not matter. You press that toast or open the app and the lines of texts are not there. They are downloading and will get there once the download finishes. You close Skype but you still appear online. Just like in the email case. Because you use push and don't rely on an open active TCP/IP connection(let's call it channel) you can't know if you are online or not and it's simpler to assume that you are online. Mail not being used as an IM it does not have an online/offline indicator. IM do need this. So this is why you always appear online on Skype even after closing the app because it acts just like email. You need to switch account and thus signaling the server that you are going offline.

    In whatsapp case thing function a little different. By keeping that channel open(by streaming music) they know when you are online when you go offline and can grab data faster because the channel is already open and data goes through it.

    On iphone (at least ios 4.0) whatsapp does not receive push notifications. You have to open the app and not close it so you can receive messages. This is because even there the whatsapp keeps the channel open and communicates through it so unless you open the app there is no channel so no notifications no messages.

    So even if whatsapp also uses push notifications they use that channel to speed up message transfer and to monitor the online / offline status of the user.

    As for battery drain you get almost the same drain you will get while listening to Pandora for example(a little less since you don't push audio through speakers). Wi-Fi and especially the phone Wi-Fi chips are optimized to go in a dormant state with minimized power consumption(maintaining a connection to the router but not transferring any data) in case the user does not have an app opened that makes downloads/ uploads. Whatsapp does not allows for this since they keep that connection open.

    Usually on a "clean wp8 phone" only the OS sends some pings to the MPNS to say that the phone is still active(I don't know the exact time but I assume it's a least 15 minutes apart).

    But whatsapp has a strange architecture. Even on iphone the mighty first platform for apps it is faulty(you need to let it run to receive messages). We don't need to talk about android since there the resource management done by OS is very liberal.

    But when you have 2 platforms were you keep the channel open you won't change your app just for windows phone platform. You won't care given it's market share. So you will ask for more "open API" from MS. I just hope that in 2 years such apps could be banned from store no matter their name.

    No app has any reason to be concerned about the Wi-Fi always on since they cant communicate in the background unless they are music apps or gps apps in which case they will force the connection to remain so no concern there.

    The other cases (the apps that stay in BG and run once 30 minutes) are limited in the amount of data they can transfer(depending if they are lockscreen apps or not) so no large data transfer can occur without user consent(meaning also keeping the app in foreground). For more advanced scenarios with no penalty for data-contracts there are other cases.
    You're incorrect about the iPhone explanation. I've tested this myself. On iOS 6 with iPhone 5 and iOS 5 with iPhone 4S. Even if you manually kill the app from the task manager, you still receive push notifications. You do not need to open the app for it to register with push notifications.
    04-15-2013 03:37 AM
  16. Kevyn Degia's Avatar
    That's BS. I mean, it doesn't make much sense to buy a smartphone and not signing a data plan with it. Especially if you rely on emails and IMs. That's COMMON SENSE.
    I am not saying that you are forced to (free will rule), but you either use your smartphone as a Gameboy only, or you manually check for notifications (thus connecting to the Wi-Fi spot) manually.
    BTW even the less advanced user understand in wp8 how to enable always-on Wi-Fi. Whatsapp could easily show a notification on first run explain how to do it.

    And plug your phone to charger so wp7 or 8 without portico will leave all connection on, Wi-Fi included

    If you are bothered with whatsapp audio hack, just run the app Stop the music, and you're done.

    (also, why doesn't someone close this post?)
    Last edited by Kevyn Degia; 04-15-2013 at 02:46 PM.
    04-15-2013 04:07 AM
66 123

Similar Threads

  1. Replies: 8
    Last Post: 03-10-2013, 04:03 PM
  2. Transfer ALL APPS from an old WP to a new one
    By sailorboi88 in forum Other Operating Systems
    Replies: 3
    Last Post: 05-07-2012, 06:28 PM
  3. Piracy of Android apps pushing devs to Wp?
    By Kredrian in forum Other Operating Systems
    Replies: 18
    Last Post: 04-30-2012, 08:04 PM
  4. New to WP app developement
    By ejb222 in forum Developers Corner
    Replies: 5
    Last Post: 04-19-2012, 09:55 AM
  5. New to WP - 'must-have' apps?
    By mike_langley in forum General Phone Discussion
    Replies: 6
    Last Post: 11-30-2011, 02:54 PM
LINK TO POST COPIED TO CLIPBOARD