Posts

Build a Real-Time Chat App in Android with PubNub (Kotlin + MVVM) – Part 1: Introduction

By Revansiddappa Kalshetty Real-time messaging has become a critical feature in today’s mobile apps — from social networks to support systems and team collaboration tools. But building it from scratch can be challenging: server setup, websockets, message queuing, typing indicators, presence, and so much more. Luckily, you don’t have to do it all yourself. In this tutorial series, I’ll show you how to build a modern, scalable in-app chat feature for Android using Kotlin , MVVM architecture , and PubNub , a powerful platform that handles the heavy lifting of real-time infrastructure. What You’ll Build Here’s a sneak peek of the features we’ll implement in this tutorial series: Real-time messaging using PubNub Chat history with message persistence Online/offline presence tracking Typing indicators Media sharing (optional) Push notifications (optional) Secure access with PubNub Access Manager (PAM) Multi-channel & group chat support All of this will be...

Build a Real-Time In-App Chat in Android Using PubNub (Kotlin + MVVM) – Complete Tutorial Series

Image
  Want to add real-time chat to your Android app without building an entire backend? In this tutorial series, you'll learn how to create a modern, scalable real-time in-app chat using Kotlin , the MVVM architecture , and PubNub — a robust platform built specifically for real-time communication. This post is your go-to index for the entire series. I’ll update it with links as each part goes live. Bookmark it now! Why PubNub? PubNub is a real-time communication platform that removes the complexity of building low-latency messaging and presence systems. Here’s what it offers out of the box: 🔧 Core Features for Android (Kotlin) Real-Time Messaging – Send and receive messages across any number of devices instantly. Message Persistence – Store and retrieve message history. User Presence – Detect when users come online or go offline. Typing Indicators – Show “User is typing…” live updates. Channel Groups – Organize multiple chatrooms or group threads. Push Notifications ...

How I Fixed My Messy Android Code with 5 Simple SOLID Principles (Using Kotlin)

Image
  If your Android app is hard to manage, crashes often, or feels like a mess — these 5 simple ideas can help make it clean, stable, and easier to work with. The Problem I Faced When I first started building Android apps, I wrote everything inside one file. My MainActivity had code for: Showing the UI Sending network requests Saving data And even handling user login It worked… until it didn’t. Small changes started breaking things. It became hard to test. Bugs popped up everywhere. The app felt fragile . The Solution: SOLID Principles Then I found something called SOLID — 5 simple ideas that help you write better, easier-to-understand code. They aren’t complicated. In fact, they made my life easier. Let me explain each one, with real and simple examples in Kotlin , so you can start using them too. What is SOLID? SOLID is a group of five principles: Letter Name Meaning S Single Responsibility One class = one job O Open/Closed Add f...

Most Developers Build Offline-First Apps Wrong — Here's What They Miss with Room

Image
  When you say your app works offline… does it really? A surprising number of Android developers proudly add “offline-first” to their app descriptions. And sure, the app opens without internet. Maybe it even loads a few screens. But dig a little deeper and it becomes clear: most offline-first implementations fall apart fast. Why? Because building an offline-first experience isn’t about just storing data locally. It’s about doing it intentionally , with the right structure, cleanup, and flow. And the culprit behind most of the silent issues? Room Database. Not because Room is bad — but because it's misunderstood. Let’s walk through some of the most common mistakes developers make when using Room in offline-first apps — and what to do instead. Mistake 1: Saving the Entire API Response into Room Many devs take the raw JSON response from their API and store it directly into Room entities — every field, every nested object, even things the app never uses. Why it’s a probl...

From Messy to Masterpiece: How Coding Standards Rescued Our Kotlin App

Image
"The app works, but the codebase feels like a haunted house." That’s how our junior dev described our project. And honestly, they weren’t wrong. When we started building our Android app in Kotlin, everything was exciting — fast screens, sleek UI, clever logic. But within a few months, we were buried in bugs, confused by code, and frustrated during every PR review. The problem? We had no coding standards. Just a jungle of inconsistent logic. So we turned things around — not with a rewrite, but with a code clean-up campaign powered by Kotlin’s best practices. Here’s how we fixed our mistakes — and how you can too. MISTAKE #1: Wild Formatting Wars No indentation rules. Random semicolons. Files looked like ransom notes. Before: fun fetchuser():List<User>{return userlist;} After (Using Kotlin style guide): fun fetchUser(): List<User> { return userList }   Fix: We adopted 4-space indentation, removed semicolons, and formatted consistently with ktlint . Benef...

"Retry When Ready" — A Smarter Way to Handle Network Failures in Jetpack Compose

Image
  " Please try again." These are the words users dread to see — especially when they’ve done nothing wrong except have poor internet. In this post, I’ll show you how to build a reusable, respectful retry system in Jetpack Compose that: Remembers failed API requests Waits for internet to return Gently asks the user: “Would you like to retry?” Works not just for login — but any network-dependent call Let’s build this like a good story: with empathy, architecture, and a clean separation of concerns. The Problem: Network Failures Break Trust Imagine this: A user opens your app and enters their login credentials. They tap Log In . Nothing happens — or worse, an error appears: “Login failed. Please try again.” Why? No internet. Maybe they walked through a tunnel. Maybe their Wi-Fi dropped. Now imagine if the app said: “You're back online. Would you like to retry logging in?” Boom. That's thoughtful UX. The Goal We want to create a centraliz...

Kotlin is King: A New Era of Joyful Development

Image
  There’s a moment every developer remembers—that time when they tried Kotlin for the first time and thought: “Wait… why isn’t all code like this?” For me, it started with a simple data model. I rewrote it from Java into Kotlin and saw 27 lines turn into five. Not just fewer lines— better lines. Cleaner. Safer. More expressive. It felt like discovering a cheat code. And I wasn’t alone. Since JetBrains introduced Kotlin, and especially after Google made it an official language for Android in 2017, the language has quietly—and confidently—earned its crown. This isn’t a rebellion. It’s a renaissance . Let’s talk about why Kotlin is King , and why so many developers are not just using it—but loving it.  Kotlin’s Superpower? Developer Happiness Kotlin isn’t trying to be flashy. It’s trying to be thoughtful . It solves real problems with elegant, modern solutions—and you can feel that care in every line of code. Here’s what makes Kotlin so powerful in practice: 1. Conc...