Technical
Measuring and Optimising INP in Android TWAs
November 2, 2026 · 7 min read
The Importance of Responsiveness in Installed Web Apps
When a user installs a Progressive Web App from the Google Play Store via a Trusted Web Activity, their expectations change dramatically. They no longer perceive the app as a website running in a browser tab. They expect immediate visual feedback when tapping buttons, navigating menus, or submitting forms. If your application lags, delays its rendering, or drops frames, the user will perceive it as a low-quality native app.
Google formally measures this aspect of user experience using the Interaction to Next Paint (INP) metric. INP assesses an application's overall responsiveness to user inputs by measuring the latency of all click, tap, and keyboard interactions throughout the lifespan of a user's session. For a TWA to pass Google Play's quality standards and deliver a truly native-like experience, maintaining a low INP is paramount.
Because a TWA runs within the system's default browser engine, it shares the exact same main-thread constraints as a traditional web page. However, because it operates without the visible safety net of a browser UI (such as loading spinners or progress bars), high latency becomes immediately obvious and frustrating to the end user.
How INP is Calculated inside a Trusted Web Activity
INP measures the time that elapses between a user initiating an interaction and the browser rendering the very next frame on the screen. This duration is divided into three distinct phases:
- Input Delay: The time between the user physical interaction and the execution of the associated event handlers. This is usually caused by a blocked main thread.
- Processing Time: The duration required to run the JavaScript code within your event listeners.
- Presentation Delay: The time the browser takes to recalculate the layout, paint the pixels, and render the updated frame to the device screen.
The final INP value of a session is typically the longest interaction observed, or a high percentile of interactions for longer sessions. To deliver a seamless user experience, your TWA should target an INP of 200 milliseconds or less. Anything over 500 milliseconds is classified as poor performance and can lead to lower user retention and poor reviews on the Google Play Store.
Identifying Common INP Culprits on Mobile Devices
Mobile devices generally possess weaker CPUs and memory configurations than desktop machines. Consequently, execution delays that go unnoticed on a developer workstation can cause severe INP spikes on a budget Android phone. Inside a TWA, several architectural patterns commonly degrade performance:
| Performance Bottleneck | Cause of High INP | Impact on Installed App |
|---|---|---|
| Monolithic JavaScript Bundles | Long compilation and parsing times during startup | UI freezes immediately after launch |
| Heavy Event Handlers | Synchronous execution of complex logic on tap | Visible delay between touch and screen update |
| Layout Thrashing | Mixing DOM reads and writes inside animation loops | Stuttering and dropped frames during transition |
| Active Service Workers | CPU contention during cache updates and network fetch interceptions | Intermittent freezing during background sync |
To keep the interface responsive, you must systematically audit these areas and ensure that the main thread is kept free to handle user interactions.
Measuring INP on Android Devices
Diagnosing INP issues inside a TWA requires measuring real performance on actual mobile hardware. You can capture and analyse these metrics using several debugging strategies.
First, you can leverage the Web Vitals JavaScript library. By embedding this lightweight script into your production PWA, you can log real-user performance data and send it directly to your analytics endpoint. This allows you to monitor how your app performs across different Android models and operating system versions in the wild.
For local profiling, remote debugging with Google Chrome is the most effective approach. Connect your testing device to your computer via USB and enable USB Debugging in the developer options. Navigate to chrome://inspect on your computer, find your running TWA, and click inspect. This launches the Chrome DevTools window targeted at your app.
Use the Performance panel to record a profile while interacting with your TWA on the phone. Make sure to simulate a slower CPU by selecting a 4x or 6x CPU slowdown option in the DevTools settings. This mimics the constraints of mid-range Android devices. Analyse the flame chart to identify long-running tasks, layout shifts, or blocked execution blocks that delay the paint event following a click.
Strategies for Optimising Processing Time and Input Delay
Once you locate the interactions causing high latency, you must restructure your JavaScript execution to yield control back to the browser as quickly as possible. The most reliable way to lower processing time is to split long tasks into smaller, asynchronous chunks.
When an event listener receives an interaction, it should only execute the code necessary to provide immediate visual feedback. Any secondary logic, calculations, or network requests should be deferred. You can achieve this using the yielding pattern. For example, rather than running a heavy calculation synchronously inside a click handler, yield execution using helper patterns:
function yieldToMainThread() { return new Promise(resolve => setTimeout(resolve, 0)); }
By inserting an await call to this helper within your asynchronous event handlers, you allow the browser engine to process pending rendering updates and calculate layout changes before continuing with the rest of your JavaScript logic. This keeps the input delay and processing times low, resulting in a much faster frame update.
Additionally, make use of the requestIdleCallback API for non-essential tasks such as sending analytics payloads or pre-fetching resources. This schedules work to be performed only when the browser main thread is idle, ensuring that immediate user inputs are prioritized over background maintenance tasks.
Optimising Service Worker Interceptions
Service workers are highly beneficial for providing offline capabilities and asset caching, but they can easily introduce CPU overhead on low-end Android devices. Every network fetch request made by your TWA passes through the service worker's fetch event handler.
If your fetch handler contains complex filtering logic, synchronous parsing, or heavy storage operations, it can delay the delivery of assets and block the rendering of the next paint frame. Keep your service worker fetch logic as simple and streamlined as possible. Avoid executing heavy cryptography, complex state evaluations, or high-volume IndexedDB operations within the main thread or the service worker thread while user interactions are actively occurring.
Conclusion
Optimising INP in a Trusted Web Activity transforms your PWA from a standard website wrapped in a container into a fast, fluid, and native-grade application. By monitoring real-user metrics, profiling your app on real Android hardware, yielding to the main thread during heavy operations, and streamlining service worker interactions, you can achieve consistent sub-200ms interaction latencies that satisfy both your users and Google Play Console performance thresholds.
Ready to ship your Android app?
Paste your PWA URL, get a signed APK and a Google Play ready AAB in minutes.
Build my app