SDKs/libraries are very important for any ecosystem and things are no different for the Android ecosystem. I have been building and shipping Android SDKs/libraries at scale for over 7 years now. Penning down some of the practices I follow that can help us write better SDKs.

Use Android Annotations

Using annotations helps reduce boilerplate code and helps developers integrating the SDK with lint warning helping them identifying issues at the call site at build time. For example,


Currently, there are multiple ways to share dependency versions between projects in multi-project builds. For example, users can declare versions or dependency coordinates directly in build scripts (in the ext block), external files (e.g dependencies.gradle), in buildSrc.

In version 7.0 Gradle has introduced an incubating feature to centrally manage dependencies in your Gradle project that tries to combine the advantages of both approaches.

Version Catalog enables build authors to centralize the dependency coordinates (group, artifact, version) of their third-party dependencies in a conventional configuration file and declare the actual dependencies in a type-safe way. Declaring dependencies this way allows easy…


In Kotlin 1.4 a new compiler feature called explicit API mode was introduced, especially for library developers.

What is Explicit API Mode?

Kotlin compiler offers explicit API mode for library authors. In this mode, the compiler performs additional checks that help make the library’s API clearer and more consistent. It adds the following requirements for declarations exposed to the library’s public API:

- Visibility modifiers are required for declarations if the default visibility exposes them to the public API. This helps ensure that no declarations are exposed to the public API unintentionally.

- Explicit type specifications are required for properties and functions that are exposed…


Starting in Android 11, whenever your application requests permission related to location, microphone, or camera, the permissions dialog will contain an additional option called Only this time.

If the user selects the Only this time option in the dialog, your application is granted temporary one-time permission. Temporary permission means that the OS would automatically revoke permission under certain conditions.

As mentioned in the documentation the application can access the related data for a period of time and that is dependent on the user’s actions or behavior.

  • If the…


Before getting into how to get Geofence working on Android 11 let’s get an overview of what Geofences are in general and how they work.

What is Geofence?

A geo-fence is a virtual perimeter for a real-world geographic area. A geo-fence could be dynamically generated — as in a radius around a point location, or a geo-fence can be a predefined set of boundaries (such as school zones or neighborhood boundaries). The use of a geo-fence is called geo-fencing, and one example of usage involves a location-aware device of a location-based service (LBS) user entering or exiting a geo-fence. …


This article assumes that readers are familiar with building Custom Layouts for Push Notification and does not touch upon what is custom layouts and how to build them. You can refer to the documentation to learn how to build custom notification layouts.

What is a Push Notification?

A notification is a message that Android displays outside your app’s UI to provide the user with reminders, communication from other people, or other timely information from your app. Users can tap the notification to open your app or take an action directly from the notification.

Today more and more companies are running their marketing campaigns via push…


Generally, as soon as the user uninstalls an application, application data is removed from the Android operating system.
This data includes the app data stored in the internal storage of the device, typically /data/data/{package_name} and the application-specific directory on the external storage. Refer to the official documentation to learn more about storing data on Android.

In Android 10, a new Manifest flag called hasFragileUserData is added. Adding this flag to the manifest file gives end-users and option to retain application data even after the application is uninstalled.

Where to add this flag?

This flag should be added inside the application tag of the Manifest file.


Before getting into how to simplify dependency management in gradle let’s first look at the current approach and problems with the approach.

How do we add dependencies in gradle?

Typically dependencies are added in the dependencies block of the build.gradle file. Below is an example of the same.

Dependencies need to be added in this way to all the modules of the project.

Problems with this approach

  1. The duplicated configuration makes version upgrades hard as every occurrence needs an update which is very tedious.
  2. Updating occurrences is also error-prone, especially in projects which have a large number of modules.

Solution to the problem

The above problem…


I found a nifty little feature in Android Q Beta 4, which allows me to pause any application for a day and automatically recommence it by the end of the day. It is a handy feature, especially when I am taking a day off from work. Once I pause my work app, I am not disturbed by any work-related messages/emails until the end of the day.

What is App Pause?

App pause is a feature in Android Q which allows us as users to pause a specific application for that day. Once an application is in pause state, you will not receive notifications from…

Umang Chamaria

Android Lead @MoEngage

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