Debug Android API Calls Like a Boss | by Reza | Jan, 2024
Now let’s explore 🕵️♂️ what are the options available today.
Overview:
Flipper is a library from Facebook that is not limited to monitoring network calls; it also offers a lot of other debugging tools, such as viewing databases in the app, shared preferences, checking the XML layout, and much more. However, for today, we’ll focus only on its capabilities in monitoring API calls.
How to use:
To get started, begin by adding the following dependencies into your build.gradle
file:
Note the release implementation is a no-op and it should be there so we don’t have to initialize Flipper only in debug builds.
Then we need to initialize Flipper library and let it know in which plugins (features of Flipper) we are interested in.
This initialization is done in the Application class to make sure it is done only once (as this might slow down the start-up time of the application one could move this to a later step after onCreate() )
FlipperModule is an object class for simplifying Dependency Injection
Note that In a real world example this would be a module providing the dependency using Dagger, Koin or Anvil.
Now we need to add an interceptor to instance of OkHttpClient:
We need to create an instance of FlipperOkhttpInterceptor and add it as an interceptor to OkHttpClient. FlipperOkhttpInterceptor needs an instance of NetworkFlipperPlugin which we created above (Note that same instance needs to be passed!)
That’s it! Now we need to head to and download a Flipper client matching our system, After downloading it we need to set it up and help it to find where adb is in our system. after doing so if you run the app on a emulator or a device we can see the following in the Flipper client:
Now we can:
- Inspect all properties of a request and response
- Share cURL command with the backend team
- Copy the response to be used for unit tests
- And much more!
✅ Request and responses can deeply be inspected. Since this is happening on your machine, it’s easier to navigate, debug and copy/paste headers, etc.
✅ Could also be used in an iOS application
❌ An external app is needed for inspection
❌ Setting up Flipper can be cumbersome sometimes (especially on Windows machines)
❌ Flipper libraries add several KB to the application size in debug mode
For more information check Flipper’s Github page:
Related Posts
Leave a Reply Cancel reply
Categories
- ! Без рубрики (1)
- ++PU (1)
- 1 (1)
- 1w (1)
- 1win Brazil (1)
- 1win India (1)
- 1WIN Official In Russia (1)
- 1win Turkiye (1)
- 1xbet egypt (1)
- 2ankarafayansustasi.net_may (1)
- ankarafayansustasi.netsiteai apr (1)
- Artificial intelligence (1)
- Arts & Entertainment, Photography (1)
- belugasitesi_mAY (1)
- BH_TOPsitesi apr (1)
- BHsitesy_may (2)
- Blog (3)
- Bookkeeping (14)
- Bootcamp de programação (2)
- Bootcamp de programación (2)
- BT_TOPsitesi apr (1)
- casino (5)
- casinom-hub (1)
- casinom-hub.comsitesi apr (3)
- colombian mail order brides (1)
- Cryptocurrency exchange (2)
- Dinamobet_next (1)
- Disease & Illness, Colon Cancer (1)
- Dumanbet (1)
- Dumanbet_next (1)
- Finance, Insurance (1)
- FinTech (5)
- Forex Trading (11)
- Galabet (1)
- Health & Fitness, Fitness Equipment (1)
- Hitbet (1)
- Home & Family, Crafts (1)
- Home & Family, Gardening (1)
- Internet Business, Audio-Video Streaming (1)
- Internet Business, Ecommerce (1)
- Internet Business, Email Marketing (1)
- Internet Business, Internet Marketing (1)
- IT Вакансії (1)
- IT Образование (5)
- IT Освіта (1)
- latin women dating (1)
- mail order bride (1)
- Mars bahis (2)
- Matadorbet (1)
- minimiri.comsitesi apr (3)
- Mobile App Development (771)
- Mostbet Russia (1)
- New Post (1)
- News (1)
- PB_TOPsitesi apr (1)
- PBsitesi_may (1)
- Pusulabet (1)
- redmirepool.bizsitesi apr (2)
- redmirepoolsitesi_may (1)
- Reference & Education, College (1)
- Reference & Education, Sociology (1)
- Rokusitesi apr (1)
- Sober living (6)
- Society, Divorce (1)
- Software development (7)
- Superbetin (1)
- Tempobet_next (1)
- thelongeststride.comsitesi apr (1)
- tipobet-turkiyesitesi apr (1)
- Ultrabet (1)
- Uncategorized (1)
- Игра (2)
- казино (1)
- Криптовалюты (1)
- Новости Криптовалют (1)
- Финтех (7)
- Форекс Брокеры (9)
- Форекс обучение (2)