Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

17 October 2023

Google’s Contacts app created a new widget 25% faster using Jetpack Glance


Link copied to clipboard
Posted by Andre Labonte, Ash Nohe, and Summers Pittman – the Glance API.

With over a billion downloads on Google Play, Google’s Contacts app is many Android users’ primary tool for viewing and organizing their personal contact information. Contacts developers aim to make the app an easy way for users to connect with the people who matter most to them. To make connecting even simpler, the Contacts engineering team built an entirely new widget from scratch using Jetpack Glance, Android’s latest framework for designing and developing widgets.

Contacts users enjoy connecting through widgets

Widgets make it easy for users to quickly access their favorite app features. Instead of having to navigate to and through an application, widgets can be added directly to a device’s home screen to create a shortcut to the information users need. With this in mind, Contacts engineers developed a new widget for users’ favorite contacts that allows them to reach friends and family faster.

Contacts widget is moved and placed in position on the home screen

“With the increasing popularity of home screen widgets,” said Phil Groman, product manager at Contacts, “we wanted to make our widget as useful as possible so that users can more easily connect with their most important contacts.”

A Google Opinion Rewards survey of Contacts widget users showed that about 80% of users with the Favorites widget on their home screen found it helpful for finding and connecting with their contacts. The survey used a 5-point scale, with 1 signifying “Not at all helpful” and 5 signifying “Extremely helpful.” Roughly 80% of the polled users selected options 4 or 5.

Faster development using Jetpack Glance

Previously, the Contacts team built the app’s widgets using RemoteViews, but the team switched to Jetpack Glance for its familiar APIs, concise Compose syntax, and out-of-the-box support of Material You dynamic theming. Jetpack Glance is also built on top of the Jetpack Compose Runtime, which makes development simple thanks to its modern declarative approach to UI and Kotlin APIs.

Contacts engineers also liked Jetpack Glance because the toolkit is backward compatible with RemoteViews code. Using Jetpack Glance, they could create the new Favorites widget with support as far back as API 23 of RemoteViews. Currently, the Favorites widget supports back to API 31. Jetpack Glance also offers a WorkManager-backed update mechanism, making it easier for developers to load a widget’s display data.

Android has additional documentation available on the Jetpack Glance landing page to help guide the development and implementation of widgets, which Contacts engineers used to build the Favorites widget. These resources helped Contacts engineers learn how to build responsive dynamic layouts for resizing, incorporate material themes, add UIs for empty and error states, and verify accessibility features like content descriptions.

After the Contacts team built the new Favorites widget, engineers estimated end-to-end development using Jetpack Glance to be 25% faster compared to another Contacts widget built using RemoteViews.

Google’s Contacts engineers estimated a 25% increase in end-to-end development speed of building a widget using Jetpack Glance compared to RemoteViews.

Doing more with Jetpack Glance

Thanks to Jetpack Glance, the Contacts team greatly reduced the time it took to produce a widget. Jetpack Glance’s Compose-based framework and intuitive Kotlin APIs made development easier, allowing engineers to quickly get a new widget off the ground and out to users.

“Jetpack Glance helped a lot during development,” said Zhen Fan, a software engineer at Contacts. “It increased development speed and made developers happier overall.”

Right now, the Contacts team is beginning to migrate another one of its widgets from RemoteViews to Jetpack Glance. The team hopes to incorporate more complex UI versions by making the switch, allowing engineers to develop richer features for users to enjoy.

Get started

Learn more about developing engaging widgets with Jetpack Glance.