Siva Ganesh Kantamani
Learn. Code. Write. Repeat. Visit me at https://about.me/sivaganesh_kantamani & Join my email list at https://tinyletter.com/Siva_Ganesh_Kantamani

More Kotlin-exclusive features you should be using

Image for post
Image for post

Unlike Java, where we need to write everything, Kotlin compiler understands the code and writes the boilerplate code under the hood. Apart from that, simple syntax and the ability to modify the language’s usage make developers more productive.

If you search the web, you’ll find tons of ways in which Kotlin solved many of Java’s pain points and how features of Kotlin aim to make development more fun.


Takeaway From This Series

This series on Kotlin programming is always focused on how to effectively use Kotlin's creative features and also how to limit ourselves from using them excessively, which will cause unforeseen problems in the long run. …


Authenticate users with the FirebaseAuth library

Image for post
Image for post
Photo by Fabian Grohs on Unsplash.

Android development is rapidly adopting Kotlin, so in this article, we are going to implement Firebase authentication through Kotlin. To add the Firebase Auth library with ktx support, add the following line under the dependencies tag at the module level of the build.gradle file:

implementation 'com.google.firebase:firebase-auth-ktx:19.3.1'

Sign-Up and Sign-in With Email and Password

When you think of authentication, email/password is one of the widely used methods. Firebase supports this method. First, let’s see how to sign up a new user. Then we will see how to implement a login for existing users.

We need to enable the email/password sign-in method in the Firebase console under the Authentication tab. …


Replace shared preferences with Jetpack DataStore

Image for post
Image for post
Photo by Mark Timberlake on Unsplash

What’s DataStore?

Over the years, Android developers have become used to storing small chunks of sensitive user data via shared preferences. This approach has the following drawbacks:

  • Sensitive data in shared preferences can be exposed easily
  • It appears safe to invoke the shared-preference operations on a UI thread, but in reality, it’s not (due to the synchronous API that can appear safe to call on the UI thread, no mechanism for signaling errors, lack of a transactional API, and more)

DataStore is a library from the Jetpack family that provides a new data-storage solution, probably replacing shared preferences. …


Flow, Layer, and Motion layouts

Image for post
Image for post
Photo by rafzin p on Unsplash

Introduction

ConstraintLayout is one of the powerful Jetpack libraries that allows developers to create complex and responsive UI quickly with interactive tooling built into Android Studio, in order to preview your XML.

One of the significant advantages of ConstraintLayout is that we can build complex UI with a flat view hierarchy (no nested view groups). This result is drawing a lesser number of layers, which increases the performance.

A few key features of ConstraintLayout

  1. We can position the views relatively one another.
  2. We can center the views using bias or other views.
  3. We can specify the aspect ratio of the view.
  4. We can group and chain the views. …

Learn how to replace LiveData with Kotlin Flow

Image for post
Image for post
Photo by James Harrison on Unsplash.

What Is LiveData?

We can describe LiveData as an observable data holder class, meaning it can hold a set of data that can be observed from other Android UI components such as activities, fragments, and services.

LiveData is lifecycle-aware. Once the component that is observing data is destroyed or not active, LiveData stops publishing data to that observer. This solves many common problems for Android developers.

Most developers use LiveData in an MVVM architecture to communicate or transmit data from the ViewModel to the view. This ensures lifecycle-aware communication between them by reducing memory leaks.

But there are cases where I saw developers use LiveData to communicate between a repository and a ViewModel, including a Google I/O application. Using LiveData in this case seems correct. After all, it’s designed to hold and pass the data. But it’s not recommended, and you’ll learn why in the following sections. …


Sometimes it’s best to execute right away

Image for post
Image for post

Hi Everyone,

It’s Siva from Programming Geeks(Medium)

This week we come up with an article about WorkManager for Immediate Tasks. This blog post focus on how to implement long-running background tasks that need to start immediately with WorkManager.

Introduction

One thing that is constantly changing in the android environment is how we handle background tasks. When the number of apps increased in the phone, the number of background tasks will also increase; most of the apps won’t check for battery health before starting their job, which leads to drain the battery in a short time.

Read the rest of the article here:
WorkManager for Immediate Tasks

Thank you for continuing to read our articles.


Sometimes it’s best to execute right away

Image for post
Image for post

Takeaway from this article

This blog post focus on how to implement long-running background tasks that need to start immediately with WorkManager. You need to be familiar with the basics of WorkManager before going any further, so I would recommend learning from here.


Overview

One thing that is constantly changing in the android environment is how we handle background tasks. When the number of apps increased in the phone, the number of background tasks will also increase; most of the apps won’t check for battery health before starting their job, which leads to drain the battery in a short time.

WorkManager is a jetpack library to help developers execute their long-running background tasks in the best way possible without affecting system health. …


Kotlin multiplatform project setup and basics

Image for post
Image for post
Image source: Author

Introduction

Kotlin makes Android development more fun. If you search the web, you’ll find tons of ways in which Kotlin solved many of Java’s pain points and how features of Kotlin aim to make Android development more fun. But most people fail to understand that Kotlin has far more capabilities than just for use with Android.

As “Open Source For You” describes it, Kotlin is a concise, safe, interoperable, and tool-friendly, multi-platform programming language. …


Google provides an in-app feel with system-wide functionalities

Image for post
Image for post
Photo by Jonas Leupe on Unsplash.

This is a guide to explain how to integrate the new Google in-app review API, which is a part of Google Play’s core library. You will also learn how to test the API using FakeReviewManager.


Introduction

Google has been working hard for a long time now to provide APIs that will give them access to Android developers in order to trigger system-wide functionalities like auto-filling OTP, in-app updates, etc. Now it’s time for in-app reviews.

With a system like Android, it’s inevitable to expect more customization and a better in-app experience. …


Roam Research, Notion and Google tasks

A productivity system with the potential to change everything

Image for post
Image for post
Photo by Alvaro Reyes on Unsplash

Do you ever think to have an extra brain to deal with things like:

  • Groceries to buy
  • Connect ideas from all your research works while creating a blog post or YouTube video
  • Track the things that you want to read/watch, but you don’t have time at the moment
  • Track progress of each project

These are the things that we don’t want to keep in mind while we’re in the moment, but surely we want to get back to them sometime in the future. If you feel the same, then you’re reading the right blog.

It is mostly about how to store: important but not necessary to deal right now kind of things safely in your second brain. It also helps you to build a methodology for saving & remembering everything you’ve gained through your experience. …


Learn all about this Kotlin-native networking library

Image for post
Image for post
Photo by the author.

In this article, you’ll learn what Ktor is and the benefits of using it. Then you’ll learn how to integrate it into your project. After that, you can read about how to create and execute a Ktor request with code snippets.

The article ends with valuable insights about Ktor. You’ll also find a GitHub Ktor sample repository link at the bottom of this article. Feel free to play around with it.


What Is Ktor?

According to its official website, “Ktor is an open-source framework for building asynchronous servers and clients in connected systems using the powerful Kotlin programming language.” …


Authenticate users with the FirebaseAuth library

Image for post
Image for post
Photo by Christopher Robin Ebbinghaus on Unsplash.

Introduction

Ever since Firebase was introduced, I thought it would have a significant effect on mobile development. The makers of Firebase have made that evident with authentication, real-time databases, machine learning, analytics, and so on.

In this article, we’re going to learn how to use the FirebaseAuth library to authenticate users using phone number authentication via OTP with the resend feature.

Let’s get started.


Why Phone Number Authentication?

There are a few benefits to using phone number-based authentication:

  • Avoid duplicate accounts: When you create an account based on a unique phone number, it’ll be hard to create multiple accounts.
  • Security: With phone number verification, users won’t have any passwords, so every time they log in, it can be done with a dynamic verification code sent directly to their mobile. …

JetPack Library with the power of Kotlin Flow

Image for post
Image for post

Hi Everyone,

It’s Siva from Programming Geeks(Medium)

This week we come up with an article about Paging3 — Jetpack Library. It’s the first part in the series of articles about paging3 on different aspects. You can learn why and how to implement paging3 in this article.

Introduction

Paging is a Jetpack library designed to help developers load & display pages of data from massive datasets with minimal use of network and system resources.

Read the rest of the article here:
Exploring Paging3 — Part 1

Thank you for continuing to read our articles.


Hi Everyone,

It’s Siva from Programming Geeks(Medium)

This week our most shared article is Koin — Kotlin Native Dependency Injection Library.

You’ll learn what dependency injection is and how to choose the right technique to implement it in your app. After that, a brief introduction to Koin and its necessity. The article ends with some code samples on how to use Koin with a GitHub repository link.

Read the rest of the article here:
Koin — Kotlin Native Dependency Injection Library.

Thank you for continuing to read our articles.


JetPack Library with the power of Kotlin Flow

Image for post
Image for post
Photo by Luca Bravo on Unsplash

Takeaway from this article

In this article, you’ll learn how and why we need to use Paging3 — the jetpack library. You’ll also learn how it is different from its previous versions. You’ll also find a detailed guide on how to implement paging3 in MVVM architecture using Spotify API.

A GitHub repository with a working sample of including all the things that I discussed here is linked at the bottom of this article. Feel free to play with it.


Introduction

Paging is a Jetpack library designed to help developers load & display pages of data from massive datasets with minimal use of network and system resources. …


Refresh your server access token with an OkHttp interceptor

Image for post
Image for post
Photo by Alexandru Acea on Unsplash

In this article, you’re going to learn how to implement a global authentication interceptor. The job of this interceptor is to refresh the access token when you got an unauthorized response.


Introduction

Updating your server to SSL doesn’t necessarily mean you’re safe out in the wild. Your server needs confirmation that you’re communicating with the user without any hacker interception (mostly stated as the man in the middle attack).

Quick Note: Use a certificate pinning feature to avoid man in the middle attacks in most cases. …


Learn everything you should know about Koin

Image for post
Image for post
Photo by Pakata Goh on Unsplash

Takeaway from this article

You’ll learn what dependency injection is and how to choose the right technique to implement it in your app. After that, a brief introduction to Koin and its necessity. The article ends with some code samples on how to use Koin with a GitHub repository link.


What’s Dependency Injection?

Dependency injection (DI) is a unique way for classes to acquire references of other classes. For example, say that class BananaMilkshake requires the Milk class. Here, BananaMilkShake is dependent on the Milk class. Often these required classes, like Milk, are called dependencies.

Implementing DI provides you with the following advantages:

  • Reusability of code
  • Ease of…

Learn about conditional execution from basics to advanced

Image for post
Image for post
Photo by Yancy Min on Unsplash

Introduction

The world is often a complicated place to write a program that executes sequentially. No matter what project you’re working on, it involves skipping few statements and then executing a series of statements recursively.

This is where conditional statements in any language come to light; often, most languages have an if statement as a fundamental step to begin with, so does Python. Without any further delay, let’s explore the different ways to write conditional statements in Python.


`If` Statement

In simple words, if statement is a combination of two components: expression and statement.

expression: It’s the condition that needs to evaluated and return a boolean (true/false)value. …


Display format > Custom Colors > Filter unnecessary data > View Mode

Image for post
Image for post
Photo by Pakata Goh on Unsplash

It doesn’t matter how powerful the weapon is unless you know how to use it. Android Studio is one of the most powerful IDEs in the wild. It has tons of shortcuts, loads of powerful features like live templates, a built-in emulator, database inspector, and more.

Yet, most of the developers don’t even know the existence of these features. As a developer, we should know the strengths of the IDE and use them to increase productivity, not the other way around.

No matter how many power features we have, debugging is the key area where developers need as much support as possible from the IDE. …


Image for post
Image for post
Photo by Rich Tervet on Unsplash

Hi Everyone,

It’s Siva from Programming Geeks(Medium)

This week our most shared article is Beginners Guide to Motion Layout. It’s a proper guide to learn fundamental features of Motion Layout and to provide a real time experience. We’ve a detailed explanation on how to implement popular Twitter splash animation with Motion Layout.

What is a Motion Layout?

Motion layout is a subclass of Constraint layout, including all of its outstanding features, and it’s fully declarative with the capability to implement complicated transitions in the XML. It is backward compatible with API level 14, meaning it covers 99% of use-cases.

The new Motion layout editor in Android Studio 4.0 makes it easy to work with Motion Layout. Motion layout editor provides a fancy environment to implement transitions, MotionScenes, and more.

Read the rest of the article here:
Beginners Guide to Motion Layout


Build Twitter’s splash screen animation with MotionLayout

Image for post
Image for post
Photo by Rich Tervet on Unsplash.

What Is MotionLayout?

MotionLayout is a subclass of ConstraintLayout that includes all of its outstanding features, and it’s fully declarative with the capability to implement complicated transitions in the XML. It is backward-compatible with API level 14, which means it covers 99% of use cases.

The new MotionLayout editor in Android Studio 4.0 makes it easy to work with MotionLayout. It provides a fancy environment to implement transitions, MotionScenes, and more.


Why Do We Need MotionLayout?

Implementing animations in Android is a complicated thing. …


It isn’t about Studying or working hard

Image for post
Image for post
Photo by JESHOOTS.COM on Unsplash

Introduction

People often think once they acquired the right knowledge about business management or mastered a trending technology, it’s inevitably to be financially successful. But they are wrong; the world is already filed with such people.

What makes you financially successful or independent is your financial education and your thought pattern. Because of our immature education system, many of us don’t have the faintest idea about investing or real estate, things that are crucial to achieve financial freedom.

The following are few valuable lessons that I learned after reading many books and watching several seminars about the economy, investments, stock market, and financial freedom. …


Encapsulation, inheritance, polymorphism, and abstraction

Image for post
Image for post
Original image Via Unsplash
1. What is Object-Oriented Programming? 
2. Classes and Objects
3. Parametrized Constructor
4. Static Fields
5. Nested Class
6. Key principles of OOP
7. Encapsulation
8. Inheritance
9. Abstraction
10. Polymorphism

Object-Oriented Programming

Object-Oriented Programming (OOP) is a way of writing programs by using objects to represent data and functions. This type of programming with objects makes it easy to communicate with one another and exchange data. Developers can also easily reuse the code.

Languages like Python support both object-oriented and functional programming to provide developers with the necessary tools to work in different environments. …


Admob, Facebook and StartApp

Image for post
Image for post
Photo by Anthony Rosset on Unsplash

Take away from this article

You’ll learn how to implement banner, and Interstitial ads from advertising companies like Admob(from Google), Facebook and StartApp in your android applications. This article also contains the best practices that I learned in five years of my experience with advertisements in mobile applications.

This article might be concentrating on how to display ads in android applications, but the overview of how things work is similar across the platforms. For suppose, in mobile applications, advertising companies use device ID to identify a specific user, whereas, on the web, they use cookies.


Introduction

In-app advertising is one of the best monetizing strategies for mobile application developers, in which they get paid to show advertisements. Displaying ads to make money isn’t a new strategy. Decades ago, newspapers are one of the best advertise strategy. As the world around us evolving rapidly, today, mobile has become an easy, effective and affordable way to meet one’s needs. …


A straightforward solution to decrease your application’s startup time

Image for post
Image for post
Photo by James Harrison on Unsplash

The Takeaway From This Article

In this article, you’ll learn how and why we need to use App Startup — the new Jetpack library. You’ll also learn how to use App Startup Initializer if the application has multiple dependencies that need content providers and how to invoke them manually.


Introduction

Users expect applications to be responsive and fast. When your app fails to meet these basic requirements, users often rate it with poor reviews in the Play Store, or even worse, they might uninstall the application.

Either way, it’s no good for business. Lately, the Android team is focused on providing better tools like Hilt (to implement DI), CameraX (to handle numerous camera-related issues), and Paging3 (to implement paging comfortably than ever with Kotlin Flow). …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store