Company
Date Published
Author
Michael Carroll
Word count
4819
Language
English
Hacker News points
None

Summary

In the third part of the series on building an Android mobile chat app with PubNub, the focus is on implementing the "Presence" feature, which involves creating a dynamic "buddy list" tab to show users' online statuses. This involves using PubNub's Presence API, an add-on that automatically detects and displays user states, such as online or offline, by leveraging publish/subscribe mechanisms. Key features discussed include the use of presence events like join, leave, and timeout, and the initialization of PubNub with configurations like publish and subscribe keys, UUIDs, and secure connections. The article explains the implementation of an Android Adapter to bridge data between PubNub callbacks and the UI, handling presence events through a subscription callback, and updating the user interface on the UI thread. Advanced features include initializing the user list with the `hereNow()` function, managing user attributes with the `state()` method, and configuring heartbeat settings to manage network connectivity issues. The tutorial concludes with the anticipation of discussing scaling techniques like Channel Groups and Multiplexing in the next part of the series.