I was going through whatsapp application and I noticed that, for the first time it fetches thumbnails from the server, keeps them in cache memory, and thereafter it fetches these from the cache memory instead of server. (Like bitmap lazyloading).
Till now I have completed implementing the bitmap lazyloading part.
However I have a question as follows:
When any contact changes its profile picture how does the user's whatsapp application detects that particular change and how does it update that particular thumbnail only, cause the application is supposed to fetch the thumbnails from cache memory.
I am clueless about this. Any help is appreciated.
EDIT:
Does it use push notification to notify the client applications to update the corresponding profile thumbnail?
Sadly, you can't see who has viewed your WhatsApp profile. WhatsApp has no feature that lets you see who viewed your profile. However, you can control who sees your WhatsApp profile. You can control who views your “last seen“, “profile photo”, “about info” & “WhatsApp status”.
Then, follow Option 1 and select "My Contacts" so that only your contacts can see your profile photo on WhatsApp. Because you've deleted the contact from your phone, they won't be able to see your picture.
If you can't see someone else's last seen, profile photo, about, status, or read receipts, it might be due to one of the following: There's a temporary network issue. You or the user changed your privacy settings for last seen or profile photo. You and the user both need to resync your contacts.
Source: WhatsApp is build upon C2DM and XMMP for message delivery. MQTT is another protocol which is used to minimise the battery usage.
When any contact changes its profile picture how does the user's whatsapp application detects that particular change and how does it update that particular thumbnail only, cause the application is supposed to fetch the thumbnails from cache memory
Answering your question: So WhatsApp may be using XMMP push or a GCM push notification(C2DM is deprecated ;] ) to inform all the client that some event has occurred and all it's client needs to take care of the same. In your case event is to update your profile pic in devices of your friends in WhatsApp contacts
In your case, you can use GCM to update clients regarding such events. I don't have much idea about XMPP but You can also have a look at Smack API(An Open Source XMPP (Jabber) client library for instant messaging and presence) and this interesting post
I hope I answered your question. Good Luck :)
Edit:
GCM is a service from Google that uses a persistent XMPP connection to communicate with Android devices. You can use any of the following techniques of GCM to achieve this.
An easy way to handle this situation will be to keep an modified datetime
in the table where you store the path of the image and thumbnail. You have to keep the url of the image along with the modified date as the parameter.
Eg:
http://yourdomain.com/images/user_id.png?q=modifieddatetime
Whenever the app will try to open this link, it will first check whether it is available in cache or not. If not the new image will be fetched from the server.
I have not tried this on Android, but it should work. I usually do this in my web applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With