简体   繁体   中英

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

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.

您可以使用此链接或使用stetho

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM