React-native - How to monitor network requests generated by the native side on android?

3.4k views Asked by At

I'm building a react-native application with a facebook login through this library: react-native-fbsdk.

Also, I would want to monitor the network requests that occur in the login process, to gain better understanding of how it works. I've read the solutions provided by this question (and its answers): monitor network requests in react-native. But the solutions provided there do not seem to work with the react-native-fbsdk library and using the default google android emulator.

I inspected the code, and it seems the requests are generated in the native side. So no fetch api is being called if I have understood right. Here is the relevant part of the code:

const NativeGraphRequestManager = require('react-native').NativeModules.FBGraphRequest;

NativeGraphRequestManager.start(this.requestBatch, timeout || 0, callback);

I was unable to find the code for the 'NativeModules.FBGraphRequest'. Even if you look from the react-native github repo and search for that, you aren't gonna find it (or at least I didn't find it). So from that I suspect that the request is generated in the native side.

Now what I'm asking is: How can I monitor those requests? Can I do it somehow in Android Studio? Or is there a trick to get the requests showing in the chrome's developer tools Network Tab?

A step by step answer will get my full points.

1

There are 1 answers

0
Rasoul Miri On

you can use this link or use stetho.