---
title: "Lessons From Building Android Widgets"
description: "Shopify built its Android analytics widgets natively rather than in React Native, because widgets must be built from RemoteViews, which React Native does not support."
url: "https://swe.quest/articles/lessons-from-building-android-widgets-3b8b116282223e62"
canonical: "https://shopify.engineering/lessons-building-android-widgets"
source: "Shopify Engineering"
published: "2022-09-22"
difficulty: "medium"
kind: "Case study"
reading_minutes: 19
tags: ["mobile","caching"]
---

# Lessons From Building Android Widgets

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2022-09-22, 19 min read, Case study. Original: [https://shopify.engineering/lessons-building-android-widgets](https://shopify.engineering/lessons-building-android-widgets)

## Summary

Shopify built its Android analytics widgets natively rather than in React Native, because widgets must be built from RemoteViews, which React Native does not support. Widget onUpdate() fires several times per cycle, so a one-minute cache keyed by widget ID removes redundant network calls and incorrect analytics. RemoteViews also append to existing views on each update, which they fixed by calling removeAllViews() before addView(). Charts are drawn from MPAndroidChart as ARGB\_8888 bitmaps, relative timestamps were dropped over battery cost, and update flicker is reduced by suppressing updates for 60 seconds after placement and rendering early from cached shared preferences.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)

## Prerequisites

- Android app development ([easy posts on Mobile](https://swe.quest/tags/mobile.md?difficulty=easy))
- Android app widgets ([easy posts on Mobile](https://swe.quest/tags/mobile.md?difficulty=easy))

## Keywords

Android, RemoteViews, AppWidgetProvider, React Native, MPAndroidChart, Jetpack Compose

## Related posts

- [Lessons From Building iOS Widgets](https://swe.quest/articles/lessons-from-building-ios-widgets-87bd1407ab4fa628.md): Shopify Engineering · 2022-09-22 · Medium · 23 min read · Mobile, Swift, Caching, Product engineering
  Shopify rebuilt its iOS analytics widgets natively in SwiftUI rather than React Native, because app extensions have tight memory limits, WidgetKit serializes SwiftUI view hierarchies, and React Native had no official widget support.
- [Five years of React Native at Shopify](https://swe.quest/articles/five-years-of-react-native-at-shopify-84f013b1c431ce8f.md): Shopify Engineering · 2025-01-13 · Easy · 9 min read · React, Mobile, Developer productivity, Engineering management
  After five years, Shopify has migrated all its mobile apps to React Native, with each team choosing its own migration timing, and reports sub-500ms P75 screen loads, over 99.9% crash-free sessions, and an end to iOS/Android feature-parity work.
- [Migrating our Largest Mobile App to React Native](https://swe.quest/articles/migrating-our-largest-mobile-app-to-react-native-da3490e74f9ce01b.md): Shopify Engineering · 2022-12-27 · Medium · 12 min read · Mobile, React, Refactoring & migrations
  Shopify is moving its largest native app, Shopify Mobile (300 screens per platform), to React Native through "Iterative Porting" rather than a rewrite.
- [Management of Native Code and React Native at Shopify](https://swe.quest/articles/management-of-native-code-and-react-native-at-shopify-a1da81505efaf180.md): Shopify Engineering · 2021-04-16 · Medium · 8 min read · Mobile, React, Java & JVM, Performance engineering
  Shopify's Point of Sale team kept complex UI such as a draggable, reorderable grid of hundreds of buttons in React Native, fixing performance with fewer re-renders, lazy rendering, memoization and Reanimated 2.
- [Migrating to React Native's New Architecture](https://swe.quest/articles/migrating-to-react-native-s-new-architecture-ea77244bbb28fd72.md): Shopify Engineering · 2025-09-05 · Medium · 12 min read · React, Mobile, Refactoring & migrations, Deployment
  Shopify moved Shopify Mobile and POS to React Native's New Architecture (Fabric) without pausing weekly releases.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
