AirAsia MOVE Sep 19, 2022

Android Network Traffic Tracking and Monitoring

Article Summary

Ahmed Alnaami from AirAsia reveals how they solved a debugging nightmare: tracking network traffic across Native, React Native, and WebViews in one super app.

Debugging API failures across multiple tech stacks traditionally meant cables, coffee, and waiting for Gradle builds. Ahmed shares how AirAsia's super app team implemented Chucker, an OkHttp interceptor, to monitor all HTTP requests in real-time through notifications and local logging.

Key Takeaways

Critical Insight

One interceptor solution can unify network debugging across your entire multi-platform mobile app without attaching a debugger.

The article includes production-ready code for the trickiest part: intercepting WebView requests that Chucker doesn't natively support.

About This Article

Problem

AirAsia's super app uses Native, React Native, PWA WebViews, and Glide image loading. Each one makes HTTP requests through different channels, which makes it hard to track and debug network traffic across all these tech stacks.

Solution

Ahmed Alnaami's team added Chucker as an OkHttp interceptor across all layers. They integrated ChuckerInterceptor into Native and Retrofit clients, added it to Glide's custom AppGlideModule, injected it via CustomNetworkModule for React Native, and built ChuckerWebViewHelper and SyncCookieHandler classes to capture WebView requests with host and file-extension filtering.

Impact

Engineers can now debug API failures without attaching debuggers, waiting for Gradle builds, or using USB cables. All HTTP requests log locally and show up as notifications. They can configure filters like interceptAllHosts, handleRequestsWithPayload, and interceptPreflight to cut down on noise and avoid issues in production WebViews.

Recent from AirAsia MOVE

Related Articles