Performance-optimization tips for apps while rendering the views

In this article, we’re going to see an overview of how the view we created in XML gets rendered on the screen in pixels.

Making a great-performing app is only possible by knowing what’s going under the hood. If you don’t know what the hardware is doing, you have a chance of using it poorly. Before exploring rendering, let’s learn the basics regarding the life cycle of a view.

Life Cycle of a View

If you have an idea of the life cycle of a view, you can skip this section.

Many of us aren’t aware views have a life cycle, but it’s very important…


Let’s learn about the basics of WorkManager

Introduction

As part of app development, we do background tasks like syncing the local database with the server, prefetching some data from an API, etc. When we say background job which means the app is not live and we are trying to do some stuff by consuming the system resources like RAM, battery, power, etc. Until Marshmallow release we are comfortable in doing these things mostly using services or intent service. Following it in Nougat Doze made its birth.

Doze mode is basically a state that intends to extend battery life by deferring app…


Understand Process, Tasks, and Back Stack

Introduction

Building an Android app is easy. But building good-performing apps under various use-cases will be brilliant. So if you have an Android Studio downloaded there is nothing that we need but few clicks to follow to create a project and install an app by running the project. On the other hand for creating an app with performance optimizations we need to know about the in’s and out’s of the components we use while building a project. Most of us in the sense of Android developers will focus on things that might be needed just for getting the work done. …


An easy and simple authentication process for apps via firebase

Introduction

Nowadays authentication has become common in almost all apps. And many of us know it would be like an overhead for beginner developers to learn and start working on the complete authentication flow from the client and server-side. Also, small start-ups at the earliest point might not be interested to afford the server maintenance and costs. Knowing user identity and serving content related to user history would increase the app engagement. So one-stop solution for this could be firebase Authentication.

In this post let’s learn What is Firebase Authentication, How to configure the authentication, and simple usage of login and…


A Jetpack recommended solution for storing data using Protobufs that provides type safety

Introduction

SharedPreferences the common way used for storing key-value pairs in local storage. Datastore is a replacement to SharedPreferences to overcome its shortcomings. Datastore is an advanced data storage solution that was built using Kotlin coroutines and Flow to store data asynchronously, consistently, and transactionally. There are two ways to store data in DataStore. Those are Preferences DataStore and Proto DataStore. Please check out my previous post about introduction to Datastore and Preferences DataStore implementation

In this post let’s see we will know more about the following:
- Proto DataStore
- Protobufs
- Basic implementation of Proto DataStore

Familiarity with coroutines


A Jetpack recommended solution for storing data asynchronously

Introduction

SharedPreferences is the common way used for storing key-value pairs in local storage. We have been using the SharedPreferences concept since the start of Android development. As we are migrating to the latest programming languages like Kotlin there needs to be an advancement in terms of dealing with SharedPreferences. SharedPreferences have their downsides which will see in upcoming parts of this post. Also frequently changing properties may cause issues.

In this post let’s see what are the disadvantages of SharedPrefrences, What is DataStore, Why do we need it, and basic implementation stuff. …


Add floating bubbles like IOS styled AssistiveTouch menu or Facebook Chat Head

Photo by Andy Makely on Unsplash

Introduction

In Android, Floating bubbles or ChatHeads allow quick access to core features without fully opening the app. For example, replying to messages through Floating bubbles.

Floating bubbles are just views attached to WindowManager with custom flags. In this post we will see how we can attach them to the window manager, drag them and change their position.

Foreground Service

To do the Floating Bubbles we need the help of a service which will be running in the background. However, background services are restricted for apps that target Android 9 (API level 28) or higher so we need a foreground service. A foreground…


Handle system-wide and custom broadcasts

Child playing with dial on stereo
Child playing with dial on stereo
Photo by Will Francis on Unsplash.

There are four different types of Android app components:

  • Activities
  • Services
  • Broadcast receivers
  • Content providers

BroadcastReceiver is one of the basic building blocks of Android components. In this article, let’s explore what broadcasts are, what broadcast receivers are, and how we can use them.

If you want to jump directly to the code base, check out the GitHub repo.

What Are Broadcasts?

In Android, broadcasts are the system-wide events that occur due to changes in system state, like LOW_BATTERY, incoming or outgoing calls, network connectivity change, device reboot, etc. These are some of the system events that require us to perform some action…


Know what a foreground service is and integrate one into your Android app

Android logo above some code
Android logo above some code
Image by the author.

In the Android world, a typical definition of a service is an application component that executes long-running tasks in the background. It does not provide a user interface. A service mainly runs on the main thread unless otherwise specified. We should make sure to run non-blocking operations in services. Services have been a part of Android components since the start, but enhancements are being done on them to provide the best user experience.

Problem

A service runs in the background and can consume resources of a location, camera, etc. from the background itself. Since it doesn’t have any UI, users will…


Coroutines are the recommended solution for Asynchronous Programming on Android

Introduction

As we all know by default all the components in an Android application use the same thread of execution which is nothing but our Main Thread. As the application was single-threaded this main thread has many duties to perform like drawing the views, executing logical pieces of code in a sequential manner, etc. So it was our responsibility to make sure that we are not blocking the main thread. To do this we need a multi-threaded approach in some cases like performing network operations, heavy logical operations, etc. …

Satya Pavan Kantamani

Android Dev at Toppr. Interested in Traveling, App development. Based in Hyderabad, India. Catch me at https://about.me/satyapavankumar

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