3

After the latest update of Whatsapp on Widows Phone Store, I have noticed that now, once they show the toast of message on my device, then they mark the message as delivered (notify the sender that the message has reached my device).

After I let the toast notification go away, I switched off all my data connection and opened Whatsapp and found that that particular message in my app. This is happening consistently on both wp7 and wp8 device. This was happening even when I had disabled background agent! Beside background agent of an app does not run all the time.

So my questions is, on windows phone platform, where the app is not allowed to run in background all the time, how is Whatsapp application getting those messages? Is it using any particular api/hack to get(in app) those messages when it's not on foreground.

ua741
  • 1,446
  • 15
  • 28

3 Answers3

4

The question you have asked has two parts: one for wp7 and the other for wp8. I will anser each one by one.

Windows phone 7

Based on my research, I have found that whatsapp is still using audio streaming api on wp7 devices to stream messages in the background i.e. when the app is not running. Whatsapp was criticized of using this API as constantly using this causes battery drainage as well as hampers the music experience of the user.

Windows Phone 8

Once whatsapp moved to wp8 they stopped using the Audio API and moved to VOIP API. Note that whatsapp doesn't use VOIP for any purpose but their manifest shows usage of VOIP api, and after reading many articles I have come to the conclusion that they are using this API to activate background agent and pool messages in the background.

While sending raw push of type 4, the background agent for VOIP is activated in which you can practically do anything from reading the payload to establishing a new socket connection subjected to restriction on usage of certain APIs

I have also found out that even if a user disables bg agents for an app some essential bg agent still continue to run for eg bg agents in audio stream API and VOIP API.

I hope this answers your question.

Milan Aggarwal
  • 5,104
  • 3
  • 25
  • 54
0

Go through this link

Push notification for Windows Phone

What will help you to understand is

The server maintains a maximum of 30 notifications (regardless of type) for each URI. Once the limit of 30 is reached, all new messages sent to the server are discarded until the device reconnects and the queue can be flushed.

Anobik
  • 4,841
  • 2
  • 17
  • 32
  • Basically whats app using the same concept as that of skype for windows or any other. more over in a mobile device fetching chunks of data from the server over a mobile connection may take lots of overhead. So once you receive the toast the message gets downloaded to your device. Try deleting your device memory it will be wiped off and you will not find any. Web Pages where as do the opposite when they fetch data from the server. :) – Anobik Sep 12 '13 at 12:15
  • 1
    You are saying once the toast is received then it gets saved on the device. So if a toast is received for my app, then when the user will open the app(without internet connection),then the app can use that particular toast? If that's what you meant then can u tell me where the toast get's downloaded? How can i access that in my app. PS: I don't think any app can access toast which are sent by Push service.(Unless the user clicks on it) – ua741 Sep 12 '13 at 12:52
  • http://msdn.microsoft.com/en-us/library/gg680266(v=pandp.11).aspx Go throught this link it will give you and idea of the local storage. And what kind of storage exactly whats app is using is some thing in their concern. We cannot use the data of another app into ours. this will be a Breach of security. And obviously a user wont want that. Still exact file structure Ill give it a search if i find the exact file location. – Anobik Sep 12 '13 at 12:56
0

In windows phone there is something called raw notifications, these are different from push notifications, push notifications display a notification, but raw notifications triggers a background task that can run under certain api restrictions for about 15 seconds. (I think, I'm not sure about the time duration), I think what whatsapp does is that it downloads the message and saves it in a local database which is maintained in the device. When whatsapp is opened it will read the local database and also sync with the server.

Please correct me if I am wrong.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129